#!/usr/bin/env bash # Registers the Forgejo Actions runner (see the runner + docker-in-docker # services in docker-compose.yml) for the silentmode organisation. Run once # on the Hephaestus host from ~/hephaestus. Re-running replaces the # registration with a new one; delete the old runner in the org settings. # # Labels: jobs that say `runs-on: linux-x64` (or ubuntu-latest) run in a # node:22-bookworm container inside docker-in-docker, one at a time. set -euo pipefail cd "$(dirname "$0")/.." NAME=${1:-hephaestus-linux} LABELS="linux-x64:docker://node:22-bookworm,ubuntu-latest:docker://node:22-bookworm" docker compose up -d docker-in-docker runner TOKEN=$(docker compose exec -T -u git forgejo forgejo actions generate-runner-token --scope silentmode | tail -n 1 | tr -d '\r') [ -n "$TOKEN" ] || { echo "no registration token" >&2; exit 1; } docker compose exec -T runner sh -c " set -e cd /data rm -f .runner forgejo-runner register --no-interactive --instance https://code.silentmode.st --token '$TOKEN' --name '$NAME' --labels '$LABELS' forgejo-runner generate-config > config.yml sed -i 's/^ capacity: .*/ capacity: 1/' config.yml " docker compose restart runner sleep 8 docker compose logs --tail 20 runner