summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-11-24 12:38:49 +0100
committerKarel Kočí <cynerd@email.cz>2020-11-24 12:38:49 +0100
commita52edff7ea8a8b831e88211063280b69153f42fe (patch)
tree10b5251313edffbfd3a4e21f77c3ee86167219aa
parent6ddc7ac584b1ba8aa790f998cf4ef40dfb80fc01 (diff)
downloadlaminar-cnf-a52edff7ea8a8b831e88211063280b69153f42fe.tar.gz
laminar-cnf-a52edff7ea8a8b831e88211063280b69153f42fe.tar.bz2
laminar-cnf-a52edff7ea8a8b831e88211063280b69153f42fe.zip
Rework how we trigger and define jobs
This simplifies jobs management and reduces duplicate input.
-rw-r--r--.gitignore4
-rw-r--r--crontab15
-rwxr-xr-xgenerate.sh44
l---------jobs/alpine-aarch64.conf1
-rw-r--r--jobs/alpine-aarch64.env1
l---------jobs/alpine-aarch64.run1
l---------jobs/alpine-amd64.conf1
-rw-r--r--jobs/alpine-amd64.env1
l---------jobs/alpine-amd64.run1
l---------jobs/alpine-armhf.conf1
-rw-r--r--jobs/alpine-armhf.env2
l---------jobs/alpine-armhf.run1
l---------jobs/alpine-armv7.conf1
-rw-r--r--jobs/alpine-armv7.env2
l---------jobs/alpine-armv7.run1
-rwxr-xr-xjobs/alpine.run8
l---------jobs/turris-dragons-mox.conf1
-rw-r--r--jobs/turris-dragons-mox.env3
l---------jobs/turris-dragons-mox.run1
l---------jobs/turris-dragons-omnia.conf1
-rw-r--r--jobs/turris-dragons-omnia.env3
l---------jobs/turris-dragons-omnia.run1
l---------jobs/turris-dragons-turris1x.conf1
-rw-r--r--jobs/turris-dragons-turris1x.env3
l---------jobs/turris-dragons-turris1x.run1
l---------jobs/turris-kittens-mox.conf1
-rw-r--r--jobs/turris-kittens-mox.env3
l---------jobs/turris-kittens-mox.run1
l---------jobs/turris-kittens-omnia.conf1
-rw-r--r--jobs/turris-kittens-omnia.env3
l---------jobs/turris-kittens-omnia.run1
l---------jobs/turris-kittens-turris1x.conf1
-rw-r--r--jobs/turris-kittens-turris1x.env3
l---------jobs/turris-kittens-turris1x.run1
l---------jobs/turris-lions-mox.conf1
-rw-r--r--jobs/turris-lions-mox.env3
l---------jobs/turris-lions-mox.run1
l---------jobs/turris-lions-omnia.conf1
-rw-r--r--jobs/turris-lions-omnia.env3
l---------jobs/turris-lions-omnia.run1
l---------jobs/turris-lions-turris1x.conf1
-rw-r--r--jobs/turris-lions-turris1x.env3
l---------jobs/turris-lions-turris1x.run1
-rwxr-xr-xjobs/turris.run9
-rwxr-xr-xssh-hook.sh4
45 files changed, 71 insertions, 72 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6ac2e34
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+jobs/alpine-*
+
+jobs/turris-*
+!jobs/turris-updater-conf.*
diff --git a/crontab b/crontab
index d636702..481b9e3 100644
--- a/crontab
+++ b/crontab
@@ -1,13 +1,2 @@
-0 1 * * * LAMINAR_REASON="Periodic" laminarc queue alpine-amd64
-0 1 * * * LAMINAR_REASON="Periodic" laminarc queue alpine-aarch64
-0 1 * * * LAMINAR_REASON="Periodic" laminarc queue alpine-armv7
-0 1 * * * LAMINAR_REASON="Periodic" laminarc queue alpine-armhf
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-dragons-mox
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-dragons-omnia
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-dragons-turris1x
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-lions-mox
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-lions-omnia
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-lions-turris1x
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-kittens-mox
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-kittens-omnia
-0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris-kittens-turris1x
+0 1 * * * LAMINAR_REASON="Periodic" laminarc queue alpine
+0 2 * * * LAMINAR_REASON="Periodic" laminarc queue turris
diff --git a/generate.sh b/generate.sh
new file mode 100755
index 0000000..70e80d4
--- /dev/null
+++ b/generate.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -eu
+cd "$(dirname "$(readlink -f "$0")")"
+
+# Turris #########################################################################
+declare -A boards animals
+boards=(["mox"]="aarch64_cortex-a53" ["omnia"]="arm_cortex-a9_vfpv3-d16" ["turris1x"]="powerpc_8540")
+animals=(["turtles"]="hbt" ["kittens"]="hbk" ["lions"]="hbl" ["dragons"]="hbd")
+
+for animal in "${!animals[@]}"; do
+ for board in "${!boards[@]}"; do
+ job="turris-$animal-$board"
+ echo "Generating: $job"
+ ln -sf ../templates/turris.run "jobs/$job.run"
+ ln -sf ../templates/turris.conf "jobs/$job.conf"
+ cat >"jobs/$job.env" <<-EOF
+ BOARD=$board
+ ANIMAL=${animals[$animal]}
+ ARCH=${boards[$board]}
+ EOF
+ done
+done
+
+
+# Alpine #########################################################################
+declare -A archmap qemu
+archs=("aarch64" "amd64" "armhf" "armv7")
+archmap=(["amd64"]="x86_64")
+qemu=(["armhf"]="arm" ["armv7"]="arm")
+
+for arch in "${archs[@]}"; do
+ job="alpine-$arch"
+ echo "Generating: $job"
+ ln -sf ../templates/alpine.run "jobs/$job.run"
+ ln -sf ../templates/alpine.conf "jobs/$job.conf"
+ if [ -n "${archmap[$arch]+x}" ]; then
+ arch="${archmap[$arch]}"
+ fi
+ {
+ echo "ARCH=$arch"
+ [ -z "${qemu[$arch]+x}" ] || \
+ echo "QEMU_ARCH=${qemu[$arch]}"
+ } >"jobs/$job.env"
+done
diff --git a/jobs/alpine-aarch64.conf b/jobs/alpine-aarch64.conf
deleted file mode 120000
index 6b2fe0b..0000000
--- a/jobs/alpine-aarch64.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.conf \ No newline at end of file
diff --git a/jobs/alpine-aarch64.env b/jobs/alpine-aarch64.env
deleted file mode 100644
index 737d645..0000000
--- a/jobs/alpine-aarch64.env
+++ /dev/null
@@ -1 +0,0 @@
-ARCH=aarch64
diff --git a/jobs/alpine-aarch64.run b/jobs/alpine-aarch64.run
deleted file mode 120000
index 7fcd92b..0000000
--- a/jobs/alpine-aarch64.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.run \ No newline at end of file
diff --git a/jobs/alpine-amd64.conf b/jobs/alpine-amd64.conf
deleted file mode 120000
index 6b2fe0b..0000000
--- a/jobs/alpine-amd64.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.conf \ No newline at end of file
diff --git a/jobs/alpine-amd64.env b/jobs/alpine-amd64.env
deleted file mode 100644
index 7315763..0000000
--- a/jobs/alpine-amd64.env
+++ /dev/null
@@ -1 +0,0 @@
-ARCH=x86_64
diff --git a/jobs/alpine-amd64.run b/jobs/alpine-amd64.run
deleted file mode 120000
index 7fcd92b..0000000
--- a/jobs/alpine-amd64.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.run \ No newline at end of file
diff --git a/jobs/alpine-armhf.conf b/jobs/alpine-armhf.conf
deleted file mode 120000
index 6b2fe0b..0000000
--- a/jobs/alpine-armhf.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.conf \ No newline at end of file
diff --git a/jobs/alpine-armhf.env b/jobs/alpine-armhf.env
deleted file mode 100644
index 73642e4..0000000
--- a/jobs/alpine-armhf.env
+++ /dev/null
@@ -1,2 +0,0 @@
-ARCH=armhf
-QEMU_ARCH=arm
diff --git a/jobs/alpine-armhf.run b/jobs/alpine-armhf.run
deleted file mode 120000
index 7fcd92b..0000000
--- a/jobs/alpine-armhf.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.run \ No newline at end of file
diff --git a/jobs/alpine-armv7.conf b/jobs/alpine-armv7.conf
deleted file mode 120000
index 6b2fe0b..0000000
--- a/jobs/alpine-armv7.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.conf \ No newline at end of file
diff --git a/jobs/alpine-armv7.env b/jobs/alpine-armv7.env
deleted file mode 100644
index 9577277..0000000
--- a/jobs/alpine-armv7.env
+++ /dev/null
@@ -1,2 +0,0 @@
-ARCH=armv7
-QEMU_ARCH=arm
diff --git a/jobs/alpine-armv7.run b/jobs/alpine-armv7.run
deleted file mode 120000
index 7fcd92b..0000000
--- a/jobs/alpine-armv7.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/alpine.run \ No newline at end of file
diff --git a/jobs/alpine.run b/jobs/alpine.run
new file mode 100755
index 0000000..d84b7a3
--- /dev/null
+++ b/jobs/alpine.run
@@ -0,0 +1,8 @@
+#!/bin/sh
+# vim: ft=sh
+set -eu
+cd "$(dirname "$(readlink -f "$0")")"
+
+for job in alpine-*.run; do
+ laminarc queue "$job"
+done
diff --git a/jobs/turris-dragons-mox.conf b/jobs/turris-dragons-mox.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-dragons-mox.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-dragons-mox.env b/jobs/turris-dragons-mox.env
deleted file mode 100644
index 350ce74..0000000
--- a/jobs/turris-dragons-mox.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=mox
-ANIMAL=hbd
-ARCH=aarch64_cortex-a53
diff --git a/jobs/turris-dragons-mox.run b/jobs/turris-dragons-mox.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-dragons-mox.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-dragons-omnia.conf b/jobs/turris-dragons-omnia.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-dragons-omnia.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-dragons-omnia.env b/jobs/turris-dragons-omnia.env
deleted file mode 100644
index 32ec245..0000000
--- a/jobs/turris-dragons-omnia.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=omnia
-ANIMAL=hbd
-ARCH=arm_cortex-a9_vfpv3-d16
diff --git a/jobs/turris-dragons-omnia.run b/jobs/turris-dragons-omnia.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-dragons-omnia.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-dragons-turris1x.conf b/jobs/turris-dragons-turris1x.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-dragons-turris1x.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-dragons-turris1x.env b/jobs/turris-dragons-turris1x.env
deleted file mode 100644
index 8470982..0000000
--- a/jobs/turris-dragons-turris1x.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=turris1x
-ANIMAL=hbd
-ARCH=powerpc_8540
diff --git a/jobs/turris-dragons-turris1x.run b/jobs/turris-dragons-turris1x.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-dragons-turris1x.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-kittens-mox.conf b/jobs/turris-kittens-mox.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-kittens-mox.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-kittens-mox.env b/jobs/turris-kittens-mox.env
deleted file mode 100644
index d9adf5f..0000000
--- a/jobs/turris-kittens-mox.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=mox
-ANIMAL=hbk
-ARCH=aarch64_cortex-a53
diff --git a/jobs/turris-kittens-mox.run b/jobs/turris-kittens-mox.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-kittens-mox.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-kittens-omnia.conf b/jobs/turris-kittens-omnia.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-kittens-omnia.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-kittens-omnia.env b/jobs/turris-kittens-omnia.env
deleted file mode 100644
index 1c70cdb..0000000
--- a/jobs/turris-kittens-omnia.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=omnia
-ANIMAL=hbk
-ARCH=arm_cortex-a9_vfpv3-d16
diff --git a/jobs/turris-kittens-omnia.run b/jobs/turris-kittens-omnia.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-kittens-omnia.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-kittens-turris1x.conf b/jobs/turris-kittens-turris1x.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-kittens-turris1x.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-kittens-turris1x.env b/jobs/turris-kittens-turris1x.env
deleted file mode 100644
index c4e4b5b..0000000
--- a/jobs/turris-kittens-turris1x.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=turris1x
-ANIMAL=hbk
-ARCH=powerpc_8540
diff --git a/jobs/turris-kittens-turris1x.run b/jobs/turris-kittens-turris1x.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-kittens-turris1x.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-lions-mox.conf b/jobs/turris-lions-mox.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-lions-mox.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-lions-mox.env b/jobs/turris-lions-mox.env
deleted file mode 100644
index dbfdc84..0000000
--- a/jobs/turris-lions-mox.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=mox
-ANIMAL=hbl
-ARCH=aarch64_cortex-a53
diff --git a/jobs/turris-lions-mox.run b/jobs/turris-lions-mox.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-lions-mox.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-lions-omnia.conf b/jobs/turris-lions-omnia.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-lions-omnia.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-lions-omnia.env b/jobs/turris-lions-omnia.env
deleted file mode 100644
index f569f32..0000000
--- a/jobs/turris-lions-omnia.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=omnia
-ANIMAL=hbl
-ARCH=arm_cortex-a9_vfpv3-d16
diff --git a/jobs/turris-lions-omnia.run b/jobs/turris-lions-omnia.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-lions-omnia.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris-lions-turris1x.conf b/jobs/turris-lions-turris1x.conf
deleted file mode 120000
index fafbc63..0000000
--- a/jobs/turris-lions-turris1x.conf
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.conf \ No newline at end of file
diff --git a/jobs/turris-lions-turris1x.env b/jobs/turris-lions-turris1x.env
deleted file mode 100644
index 2171d68..0000000
--- a/jobs/turris-lions-turris1x.env
+++ /dev/null
@@ -1,3 +0,0 @@
-BOARD=turris1x
-ANIMAL=hbl
-ARCH=powerpc_8540
diff --git a/jobs/turris-lions-turris1x.run b/jobs/turris-lions-turris1x.run
deleted file mode 120000
index 683ec07..0000000
--- a/jobs/turris-lions-turris1x.run
+++ /dev/null
@@ -1 +0,0 @@
-../templates/turris.run \ No newline at end of file
diff --git a/jobs/turris.run b/jobs/turris.run
new file mode 100755
index 0000000..dc07fd9
--- /dev/null
+++ b/jobs/turris.run
@@ -0,0 +1,9 @@
+#!/bin/sh
+# vim: ft=sh
+set -eu
+cd "$(dirname "$(readlink -f "$0")")"
+
+for job in turris-*.run; do
+ #laminarc queue "$job"
+ echo laminarc queue "$job"
+done
diff --git a/ssh-hook.sh b/ssh-hook.sh
index 2980c03..6b34258 100755
--- a/ssh-hook.sh
+++ b/ssh-hook.sh
@@ -8,6 +8,10 @@ if [ -z "$SSH_ORIGINAL_COMMAND" ]; then
git fetch --prune --force
git reset --hard origin/master
+ echo "Clean up and generate"
+ git clean -xdff
+ ./generate.sh
+
echo "Deploy ssh configuration"
cp ssh/config ~/.ssh/config
cp ssh/authorized_keys ~/.ssh/authorized_keys