From f0f17ad2ffc172756b9a628f0ddb39fb5091584d Mon Sep 17 00:00:00 2001 From: grok-reviewer-andresmgsl Date: Sat, 1 Aug 2026 21:33:11 +0000 Subject: [PATCH] fix: warn only on retired default labels, not custom maps (#144) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plain converge comparing RECORDED to the current default nags every runner registered with intentional --labels (including drill Leg 3). Match known past DEFAULT_LABELS strings instead — same intent, no noise. Changelog split per review. Refs #144 --- changelog.d/144.md | 7 +++++- commands/forgejo-runner-install.sh | 34 ++++++++++++++++++------------ test/cli.sh | 17 +++++++++------ 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/changelog.d/144.md b/changelog.d/144.md index 6afdf69..6912bdc 100644 --- a/changelog.d/144.md +++ b/changelog.d/144.md @@ -1,3 +1,8 @@ +### Added + +- Default Forgejo runner labels include opt-in `ubuntu-latest-full` for the GitHub-parity image (#144) + ### Fixed -- Forgejo runners keep the slim `act-22.04` image for `ubuntu-latest` (full is ~54.5 GB and does not fit a box-class ci tenant); `ci.yml` installs `shellcheck` when missing, and the default map offers opt-in `ubuntu-latest-full` (#144) +- `ci.yml` installs `shellcheck` when the runner image lacks it, so Forgejo's slim `ubuntu-latest` can run `check` (#144) +- Plain `rig forgejo-runner install` warns when recorded labels are a retired rig default, without nagging custom `--labels` (#144) diff --git a/commands/forgejo-runner-install.sh b/commands/forgejo-runner-install.sh index f768738..de5cb4d 100755 --- a/commands/forgejo-runner-install.sh +++ b/commands/forgejo-runner-install.sh @@ -425,21 +425,29 @@ if [ -e "$RUNNER_DIR/.runner" ]; then # # Two warn paths (#144): # EXPLICIT --labels that differs → operator asked and it was not applied. - # Plain converge whose recorded labels differ from the current default → - # rig's default map moved (e.g. a new opt-in label). Without this warn the - # operator re-runs install, sees "already registered", and believes they - # have the new default while Forgejo still holds the old set. - # Custom --labels that match what was registered stay quiet. Jobs matching - # labels this runner already has are unaffected either way — re-register - # only to pick up labels that are missing from the recorded set. + # Plain converge whose recorded labels match a known *retired* default → + # rig's default map moved (e.g. added ubuntu-latest-full). Without this + # the operator re-runs install, sees "already registered", and believes + # they have the new default while Forgejo still holds the old set. + # + # Do NOT warn on every RECORDED != current default: that fires forever for + # any runner the operator deliberately gave custom --labels (drill's Leg 3 + # registers drill:docker://node:22-bookworm). The old LABELS_EXPLICIT-only + # gate existed to avoid that noise; retired-default matching keeps the + # silence for intentional maps and still catches silent drift off a past + # rig default. Re-register only to pick up labels the old set never had — + # nothing matching the recorded set is broken by the map change alone. if [ -r "$RUNNER_DIR/.rig-labels" ]; then RECORDED="$(cat "$RUNNER_DIR/.rig-labels")" - if [ "$RECORDED" != "$LABELS" ]; then - if [ "$LABELS_EXPLICIT" -eq 1 ]; then - warn "--labels was not applied: this runner is already registered, and Forgejo owns its labels from registration time. It still has: ${RECORDED}. Labels are what 'runs-on' matches, so changing them means re-registering: 'rig forgejo-runner remove' then install again with the labels you want." - else - warn "this runner's labels differ from rig's current default (recorded: ${RECORDED}). Forgejo owns labels from registration time — a plain re-run does not change them. Re-register ('rig forgejo-runner remove' then install) only if you need labels the recorded set is missing (e.g. a newly added default). Jobs matching labels this runner already has are unaffected." - fi + if [ "$LABELS_EXPLICIT" -eq 1 ] && [ "$RECORDED" != "$LABELS" ]; then + warn "--labels was not applied: this runner is already registered, and Forgejo owns its labels from registration time. It still has: ${RECORDED}. Labels are what 'runs-on' matches, so changing them means re-registering: 'rig forgejo-runner remove' then install again with the labels you want." + elif [ "$LABELS_EXPLICIT" -eq 0 ]; then + # One pattern per past DEFAULT_LABELS value. Add a pattern when the + # default string changes so plain converges of older installs notice. + case "$RECORDED" in + 'ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04,docker:docker://node:22-bookworm') + warn "this runner was registered with an older rig default label set. The current default adds ubuntu-latest-full (the GitHub-parity image). Labels are fixed at registration, so picking it up means re-registering: 'rig forgejo-runner remove' then install again. Nothing you run today is affected — re-register only if you want the new label." ;; + esac fi fi else diff --git a/test/cli.sh b/test/cli.sh index c43ab21..2fb8097 100644 --- a/test/cli.sh +++ b/test/cli.sh @@ -3714,13 +3714,16 @@ check "forgejo-runner: an explicit --labels on a rerun warns it was not applied" grep -o -- "--labels was not applied" "$FR" check "forgejo-runner: that warning is gated on --labels being EXPLICIT" 0 "LABELS_EXPLICIT" \ grep -o "LABELS_EXPLICIT" "$FR" -# #144 option B: plain converge must notice when rig's default map moved since -# registration (e.g. a newly added ubuntu-latest-full), without implying that -# every re-run rewrites Forgejo-side labels or that existing matching jobs fail. -check "forgejo-runner: plain converge warns when recorded labels differ from current default" 0 "differ from rig's current default" \ - grep -o "differ from rig's current default" "$FR" -check "forgejo-runner: that plain-converge warn says re-register only for missing labels" 0 "only if you need labels the recorded set is missing" \ - grep -o "only if you need labels the recorded set is missing" "$FR" +# #144 option B: plain converge warns only for known *retired* defaults — not +# for every RECORDED != current default (that would noise custom --labels +# forever, including drill's Leg 3). Pins match the case arm + message. +check "forgejo-runner: plain converge warns on a known retired default label set" 0 "registered with an older rig default label set" \ + grep -o "registered with an older rig default label set" "$FR" +check "forgejo-runner: that warn says re-register only if you want the new label" 0 "re-register only if you want the new label" \ + grep -o "re-register only if you want the new label" "$FR" +check "forgejo-runner: the pre-#144 default string is the retired-default case arm" 0 \ + "ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04,docker:docker://node:22-bookworm" \ + grep -F "ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04,docker:docker://node:22-bookworm" "$FR" # Default map: slim ubuntu-latest (act), opt-in full, docker — pin the three # so a silent drop of the full rider or a flip back to full-as-default fails. check "forgejo-runner: DEFAULT_LABELS maps ubuntu-latest to act-22.04 (slim)" 0 "ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04" \