forgejo-stack/scripts
Randa f363db42c7 feat(runner): auto-rebuild runner image when consumer yarn.lock changes
Drops the manual refresh dance. A new `runner-refresh` compose service
polls Forgejo every RUNNER_REFRESH_INTERVAL seconds (default 300),
fetches yarn.lock + package.json from each repo in
RUNNER_CACHE_SEED_REPOS, hashes them, and rebuilds
forgejo-stack/job:latest whenever the hash changes. `docker create`
on the rebuilt tag is automatic — forgejo-runner uses forcePull=false
so subsequent job containers pick up the refreshed image without a
runner restart.

- scripts/refresh-runner-image.sh: idempotent; hash-compares against
  cache-seed/.last-fetched.sha256 to skip rebuilds when nothing
  changed. Uses `sed` (not `grep -oP`) so it works under busybox
  inside docker:cli's alpine base.
- docker-compose.yml: adds the `runner-refresh` service (docker:cli
  + docker.sock + project bind-mount + bash/curl install). Idles
  via `sleep infinity` when RUNNER_CACHE_SEED_REPOS is unset, so
  the service is safe to leave running on stacks that don't pre-warm.
- setup.sh: one-time prime after Forgejo is healthy so fresh installs
  bake the cache before the runner takes its first job. Subsequent
  refreshes are driven by the service.
- .env.example: documents RUNNER_CACHE_SEED_REPOS and
  RUNNER_REFRESH_INTERVAL.

Verified end-to-end: pushed a yarn.lock mutation → refresh tick
detected diff → rebuilt image in ~25s → second tick reported
"lockfiles unchanged; image current".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 11:23:46 +04:00
..
bootstrap-forgejo.sh feat: bootstrap honors --restore mode for cross-host migration 2026-05-10 20:44:35 +04:00
bootstrap-repo.sh feat: per-repo bot workflow opt-in via bootstrap-repo.sh 2026-05-10 20:32:23 +04:00
lib.sh feat: add scripts/lib.sh with logging, env, retry, api helpers 2026-05-10 19:41:29 +04:00
migrate-from-github.sh feat: add migrate-from-github.sh helper 2026-05-10 20:38:38 +04:00
refresh-runner-image.sh feat(runner): auto-rebuild runner image when consumer yarn.lock changes 2026-05-16 11:23:46 +04:00
smoke-test.sh feat: per-repo bot workflow opt-in via bootstrap-repo.sh 2026-05-10 20:32:23 +04:00