test: introduce SSH based CI for non-native test hosts (#644)
* feat: ssh based CI Signed-off-by: Xe Iaso <me@xeiaso.net> * test: implement SSH ci with caches and github actions Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): fix known hosts secret Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): clone the repo, that's important Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: spelling Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): speed up ci by prebaking the SSH CI image Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): set -euo Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): enable pull_request_target so things work Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: spelling Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): oh goody it's broken Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): add cronjob to rebuild ci runner image Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): also run yeet Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): force git version for yeet Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): run set -x in the container Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): fix yeet? Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): remove yeet for now Signed-off-by: Xe Iaso <me@xeiaso.net> * test(ssh-ci): disable for PRs for now Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
bbdee34f37
commit
f5140ae57b
8 changed files with 151 additions and 4 deletions
33
test/ssh-ci/rigging.sh
Normal file
33
test/ssh-ci/rigging.sh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
[ ! -z "${DEBUG:-}" ] && set -x
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: rigging.sh <user@host>"
|
||||
fi
|
||||
|
||||
CIRunnerImage="ghcr.io/techarohq/anubis/ci-runner:latest"
|
||||
RunID=${GITHUB_RUN_ID:-$(uuidgen)}
|
||||
RunFolder="anubis/runs/${RunID}"
|
||||
Target="${1}"
|
||||
|
||||
ssh "${Target}" uname -av
|
||||
ssh "${Target}" mkdir -p "${RunFolder}"
|
||||
git archive HEAD | ssh "${Target}" tar xC "${RunFolder}"
|
||||
|
||||
ssh "${Target}" << EOF
|
||||
set -euo pipefail
|
||||
set -x
|
||||
mkdir -p "anubis/cache/{go,go-build,node}"
|
||||
podman pull ${CIRunnerImage}
|
||||
podman run --rm -it \
|
||||
-v "\$HOME/${RunFolder}:/app/anubis" \
|
||||
-v "\$HOME/anubis/cache/go:/root/go" \
|
||||
-v "\$HOME/anubis/cache/go-build:/root/.cache/go-build" \
|
||||
-v "\$HOME/anubis/cache/node:/root/.npm" \
|
||||
-w /app/anubis \
|
||||
${CIRunnerImage} \
|
||||
sh /app/anubis/test/ssh-ci/in-container.sh
|
||||
ssh "${Target}" rm -rf "${RunFolder}"
|
||||
EOF
|
||||
Loading…
Add table
Add a link
Reference in a new issue