5 Commits

9 changed files with 75 additions and 40 deletions

6
.gitignore vendored
View File

@@ -1,8 +1,6 @@
# Testing outputs # Testing outputs
src/HelloWorld src/ascii-invaders**
src/HelloWorld/** src/HelloWorld**
src/ascii-invaders
src/ascii-invaders/**
pkg/ pkg/
testing.log testing.log

12
LICENSE
View File

@@ -16,12 +16,16 @@
ANINIX ADDENDUM ANINIX ADDENDUM
Trademark Pending 2017 (https://aninix.net/irc/) Trademark 2017 (https://aninix.net/)
The "AniNIX" name and |> logo is trademark-pending as of 2017. All The "AniNIX" name and |> logo are trademarked as of 2017/11/21.
AniNIX materials can be reproduced and re-used, though you must AniNIX materials may be reproduced and re-used (though you must
contact the admins of the network to get written permission to use contact the admins of the network to get written permission to use
the AniNIX name. the AniNIX name or logo) so long as such reproduction or re-use
does not inhibit the original AniNIX use of the same.
Attribution is appreciated for other materials but not legally Attribution is appreciated for other materials but not legally
required or necessary. required or necessary.
"AniNIX" trademark serial: 87177883
|> Logo trademark serial: 87177887

View File

@@ -21,7 +21,7 @@ install: ${list} MaatIcon.png
for i in ${systemdList}; do install -m 0644 -o root $$i ${pkgdir}/usr/lib/systemd/system; done for i in ${systemdList}; do install -m 0644 -o root $$i ${pkgdir}/usr/lib/systemd/system; done
clean: clean:
cat .gitignore | sudo xargs rm -Rf git clean -fdX
uninstall: uninstall:
for i in ${list}; do rm -Rf ${installDir}/$$i; done for i in ${list}; do rm -Rf ${installDir}/$$i; done
@@ -29,7 +29,10 @@ uninstall:
rmdir -p ${pkgdir}${serverRoot}/src rmdir -p ${pkgdir}${serverRoot}/src
rmdir -p ${pkgdir}${serverRoot}/pkg rmdir -p ${pkgdir}${serverRoot}/pkg
test: clean test:
./maat -h | grep -c Usage 1>/dev/null
extendedtest: clean
sudo ./maat -u $$USER -T sudo ./maat -u $$USER -T
test -d src test -d src
test -d src/ascii-invaders test -d src/ascii-invaders

View File

@@ -28,7 +28,7 @@ validpgpkeys=()
prepare() { prepare() {
git pull git pull
make -C .. test && make -C .. clean make -C .. test
} }
build() { build() {

2
README
View File

@@ -1,2 +0,0 @@
AniNIX::Maat \\ Quality Assurance and Reporting Framework
This package allows automation around code packaging and deployment. It will pull from both AniNIX::Foundation and ArchLinux AUR.

15
README.md Normal file
View File

@@ -0,0 +1,15 @@
Continuous integration and continuous delivery (CI/CD) are integral to current DevOps mentality -- a step further is GitOps, wherein developers only need to interact with Git and their artifacts are magically available downstream. AniNIX/Maat is intended to provide this for AniNIX and [ArchLinux AUR](https://wiki.archlinux.org/title/Arch_User_Repository) packages.
# Etymology
Maat is named for [the Egyptian goddess of truth and order](https://en.wikipedia.org/wiki/Maat) -- Maat was deeply tied into the idea of honorable contribution to community and the flow of the Nile, from which came the lifeblood of Egypt. Truth is reflected in the Maat service's use of testing and GPG signing prior to delivering packages, and the communal aspect is that Maat is how we deliver AniNIX and AUR packages for the world to use.
# Relevant Files and Software
Maat runs as a [systemd.timer](https://man.archlinux.org/man/systemd.timer.5) nightly, invoking our build script. Adhoc builds can be requested from admins. Output gets published on the [landing page](https://maat.aninix.net) from our build pipeline -- there you can download packages, view build logs, see testing status, etc.
Our CI/CD pipeline attempts to pull directly from Git sources, either from the AniNIX or the curated AUR, build those packages, and make the available to systems downstream. The `/usr/local/etc/Maat/aur.list` file allows the admin to control which AUR packages are pulled and built -- output files from builds can help identify issues like missing public GPG keys or dependency issues.
Maat also consumes a GPG key. The admin will need to set up this key and publish it. You will need to add [our GPG key](https://aninix.net/AniNIX/ShadowArch/src/branch/main/EtcFiles/aninix.gpg) to use the AniNIX's CI/CD.
# Available Clients
As Maat is a pipeline for ArchLinux systems, the primary client is [Pacman](https://wiki.archlinux.org/title/Pacman). You can see how to subscribe your host to Maat in [this configuration snippet](https://aninix.net/AniNIX/Ubiqtorate/src/branch/main/roles/ShadowArch/files/pacman.conf#L103).

20
maat
View File

@@ -83,7 +83,7 @@ function BuildRepo() {
git clone "$repo" git clone "$repo"
fi fi
cd "$repodir" cd "$repodir"
git reset --hard origin &>/dev/null git clean -fdX
output="$(git pull 2>&1)" output="$(git pull 2>&1)"
if [ -n "$incremental" ] && [ $( echo "$output" | grep -c 'Already up to date.' ) -eq 1 ]; then if [ -n "$incremental" ] && [ $( echo "$output" | grep -c 'Already up to date.' ) -eq 1 ]; then
return; return;
@@ -150,12 +150,26 @@ timeout="90s"
# Stat tracking # Stat tracking
starttime=`date +%s` starttime=`date +%s`
function usage() {
### Show helptext
# param retcode: what to exit
retcode="$1"
cat <<EOM
Usage: $0
$0 -T # Extended testing
$0 -b homedir -c aurconf -u user -t timeout
Add -s to skip patching or -v for verbosity.
EOM
exit $retcode
}
# Parse arguments # Parse arguments
while getopts 'b:c:hil:st:Tu:v' OPTION; do while getopts 'b:c:hil:st:Tu:v' OPTION; do
case "${OPTION}" in case "${OPTION}" in
b) homedir="${OPTARG}" ;; b) homedir="${OPTARG}" ;;
c) aurconf="${OPTARG}" ;; c) aurconf="${OPTARG}" ;;
h) Usage; exit 0 ;; h) usage; exit 0 ;;
i) incremental=1 ;; i) incremental=1 ;;
l) cmdstring="$0"; for arg in $@; do if [ "$arg" != "-l" ] && [ "$arg" != "${OPTARG}" ]; then cmdstring="$cmdstring \"${arg}\""; fi; done; exec /bin/bash -c "$cmdstring | tee -a \"${OPTARG}\""; ;; l) cmdstring="$0"; for arg in $@; do if [ "$arg" != "-l" ] && [ "$arg" != "${OPTARG}" ]; then cmdstring="$cmdstring \"${arg}\""; fi; done; exec /bin/bash -c "$cmdstring | tee -a \"${OPTARG}\""; ;;
s) skipPatching=1 ;; s) skipPatching=1 ;;
@@ -163,7 +177,7 @@ while getopts 'b:c:hil:st:Tu:v' OPTION; do
T) export MAATTESTINGVAR=1; exec $0 -l ./testing.log -u "$deprivuser" -v -s -c <(echo https://aur.archlinux.org/ascii-invaders.git) -b . ;; T) export MAATTESTINGVAR=1; exec $0 -l ./testing.log -u "$deprivuser" -v -s -c <(echo https://aur.archlinux.org/ascii-invaders.git) -b . ;;
u) deprivuser="${OPTARG}" ;; u) deprivuser="${OPTARG}" ;;
v) set -x ;; v) set -x ;;
*) usage; exit 1 ;; *) echo "Internal GitOps CI/CD Pipeline"; usage 1 ;;
esac esac
done done

View File

@@ -6,7 +6,7 @@ ConditionPathExists=|!/srv/maat/pkg/.lock
ExecStartPre=/usr/sbin/mkdir /srv/maat/pkg/.lock ExecStartPre=/usr/sbin/mkdir /srv/maat/pkg/.lock
ExecStart=/usr/local/bin/maat ExecStart=/usr/local/bin/maat
ExecStopPost=/usr/sbin/rmdir /srv/maat/pkg/.lock ExecStopPost=/usr/sbin/rmdir /srv/maat/pkg/.lock
Type=oneshot Type=simple
RemainAfterExit=no RemainAfterExit=no
User=root User=root
Group=root Group=root

View File

@@ -0,0 +1,3 @@
#!/bin/bash
make extendedtest