feat(infra): add ci-runners.sh wrapper for the runner stack #81
Reference in New Issue
Block a user
Delete Branch "feat/infra/ci-runners-sh-wrapper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Mirrors the convenience-script pattern we adopted for
infra/local/dev.sh: typingdocker compose -f infra/ci-runners.compose.yml ...for routine ops gets old fast, the pre-pull of the catthehacker job images is documented but easy to forget, and the "rotation of one runner at a time" tip ininfra/README.mdis a sequence the contributor was supposed to hand-roll every time.infra/ci-runners.shexposes the everyday verbs and automates the rolling-restart pattern.What lands
./ci-runners.sh up./ci-runners.sh up --prepullact-22.04+:full-22.04) on the host first./ci-runners.sh downdata/runner-N/.runnercredentials)./ci-runners.sh restart <runner>./ci-runners.sh rotate./ci-runners.sh statusdocker compose psfor the runner services./ci-runners.sh logs [runner]./ci-runners.sh pull-images./ci-runners.sh <other>docker compose -f ci-runners.compose.yml ...The destructive
down -v(wipesdata/, forces re-registration with a fresh Gitea token) is intentionally not exposed as a verb — invokedocker compose -f ci-runners.compose.yml down -vdirectly so the path is explicit at the typing level.Doc updates (
infra/README.md)docker pull/docker compose upsteps for./ci-runners.sh up --prepull.ci-runners.sh" subsection with the cheat-sheet table.rotate/restart/logsverbs as the canonical commands; the raw-docker-compose form is kept in parentheses as the underlying mechanism.RUNNERS=()array at the top of the script.Trade-off
The 15 s pause in
rotateis a conservative approximation —act_runnerdoesn't expose a Compose healthcheck, so we can't poll for ready. Adjust the constant at the top of the script if reality argues for a different value.Test plan
./infra/ci-runners.sh statusshows the three runners running../infra/ci-runners.sh logs runner-1tails runner-1's stdout../infra/ci-runners.sh rotatecycles through runner-1 → runner-2 → runner-3 with the 15 s pauses;statusbetween rotations shows N-1 runners online at any moment (with a brief gap for the one currently restarting)../infra/ci-runners.sh restart runner-99errors out with the "unknown runner" message.Mirrors the convenience-script pattern we adopted for infra/local/dev.sh: typing `docker compose -f infra/ci-runners.compose.yml ...` for routine ops (status, restart, log tail) gets old fast, the pre-pull of the catthehacker job images is documented but easy to forget, and the "rotation of one runner at a time" tip in infra/README.md is a sequence the contributor was supposed to hand-roll every time. `infra/ci-runners.sh` exposes: ./ci-runners.sh up # bring up runner-1..3 ./ci-runners.sh up --prepull # pre-pull job images first ./ci-runners.sh down # stop + remove (preserves data/runner-N/.runner creds) ./ci-runners.sh restart <runner> # restart one runner ./ci-runners.sh rotate # rolling restart with a 15 s pause between each — keeps at least N-1 runners online through a config refresh ./ci-runners.sh status # docker compose ps ./ci-runners.sh logs [runner] # follow logs ./ci-runners.sh pull-images # idempotent image refresh Anything else is passed through to `docker compose -f ci-runners.compose.yml ...`. The destructive `down -v` (wipes data/, forces re-registration with a fresh Gitea token) is intentionally NOT exposed as a verb — invoke docker compose directly so the path is explicit at the typing level. `infra/README.md` updated: - Inventory table at the top picks up the script. - "First-time registration" walkthrough swaps the explicit docker pull / docker compose up steps for `./ci-runners.sh up --prepull`. - New "Convenience script — ci-runners.sh" subsection with the cheat-sheet table. - "Operational tips" rephrased to point at the script's `rotate` / `restart` / `logs` verbs as the canonical commands; the raw-docker-compose form is kept in parentheses as the underlying mechanism. - "Adding a fourth runner" tip now reminds to update the RUNNERS=() array at the top of the script. The 15 s pause in `rotate` is a conservative approximation — act_runner doesn't expose a Compose healthcheck, so we can't poll for ready. Adjust the constant if reality argues for a different value. Smoke-tested help + arg-validation paths on the host.