chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
runner-host: watch only named repositories, and take the image from another host
deploy/runner-host/deploy.sh+13−4
| @@ -39,9 +39,16 @@ REPOS="${KNOTLESS_RUNNER_REPOS:-}" | ||
SSH="ssh -o StrictHostKeyChecking=accept-new $DEST" | ||
COMMIT="$(git rev-parse HEAD 2>/dev/null || echo local)" | ||
| ||
echo "==> building knotless at ${COMMIT:0:12} on $DEST" | ||
git archive --format=tar HEAD | | ||
$SSH "docker build -q --build-arg KNOTLESS_COMMIT=$COMMIT -t knotless:current -" | ||
if [ -n "${KNOTLESS_RUNNER_IMAGE_FROM:-}" ]; then | ||
# A box too small to build knotless takes the image another host built. | ||
echo "==> copying knotless:current from $KNOTLESS_RUNNER_IMAGE_FROM to $DEST" | ||
ssh -o StrictHostKeyChecking=accept-new "$KNOTLESS_RUNNER_IMAGE_FROM" 'docker save knotless:current | gzip -1' | | ||
$SSH 'gunzip | docker load -q' | ||
else | ||
echo "==> building knotless at ${COMMIT:0:12} on $DEST" | ||
git archive --format=tar HEAD | | ||
$SSH "docker build -q --build-arg KNOTLESS_COMMIT=$COMMIT -t knotless:current -" | ||
fi | ||
| ||
if [ -n "${KNOTLESS_RUNNER_IDENTIFIER:-}" ] && [ -n "${KNOTLESS_RUNNER_PASSWORD:-}" ]; then | ||
printf 'KNOTLESS_IDENTIFIER=%s\nKNOTLESS_PASSWORD=%s\n' "$KNOTLESS_RUNNER_IDENTIFIER" "$KNOTLESS_RUNNER_PASSWORD" | | ||
| @@ -55,7 +62,9 @@ $SSH '[ -f /etc/knotless/run.env ]' || { | ||
{ | ||
echo "KNOTLESS_RUN_REPOS=$REPOS" | ||
[ -z "${KNOTLESS_RUNNER_ARGS:-}" ] || echo "KNOTLESS_RUN_ARGS=$KNOTLESS_RUNNER_ARGS" | ||
for v in JOBS CPUS MEMORY TIMEOUT ALLOWANCE PRIVATE_ALLOWANCE; do | ||
# KNOTLESS_RUNNER_DISCOVER set empty watches only KNOTLESS_RUNNER_REPOS. | ||
[ -z "${KNOTLESS_RUNNER_DISCOVER+set}" ] || echo "KNOTLESS_RUN_DISCOVER=$KNOTLESS_RUNNER_DISCOVER" | ||
for v in JOBS OWNER_JOBS CPUS MEMORY TIMEOUT ALLOWANCE PRIVATE_ALLOWANCE; do | ||
from="KNOTLESS_RUNNER_$v" | ||
[ -z "${!from:-}" ] || echo "KNOTLESS_RUN_$v=${!from}" | ||
done | ||
deploy/runner-host/docker-compose.yml+2−2
| @@ -37,7 +37,7 @@ services: | ||
--pids 4096 | ||
--run-timeout ${KNOTLESS_RUN_TIMEOUT:-3600} | ||
--jobs ${KNOTLESS_RUN_JOBS:-4} | ||
--owner-jobs 2 | ||
--owner-jobs ${KNOTLESS_RUN_OWNER_JOBS:-2} | ||
--allowance ${KNOTLESS_RUN_ALLOWANCE:-2000} | ||
--private-allowance ${KNOTLESS_RUN_PRIVATE_ALLOWANCE:-500} | ||
--keep-checks 30 | ||
| @@ -47,7 +47,7 @@ services: | ||
--work /var/lib/knotless-run/work | ||
--caches /var/lib/knotless-run/caches | ||
--pulls | ||
--discover | ||
${KNOTLESS_RUN_DISCOVER---discover} | ||
${KNOTLESS_RUN_ARGS:-} | ||
${KNOTLESS_RUN_REPOS:-} | ||
environment: | ||