fix: gitea controller
runner nix smoke / nix label and flake smoke (push) Failing after 1m39s
runner ubuntu smoke / ubuntu-latest label smoke (push) Successful in 1s

This commit is contained in:
2026-11-02 20:06:04 +00:00
parent 0143a1a760
commit 9b5d2ed657
7 changed files with 388 additions and 60 deletions
+18 -6
View File
@@ -522,7 +522,7 @@ gcr_sweep_stale_runners() {
runners="$(gcr_gitea_list_runners "$repo")" || continue
# Here-doc instead of pipe: dash runs pipe tails in a subshell, which
# would strand gcr_event/audit writes from the caller's perspective.
while read -r rid rname; do
while read -r rid _rbusy _rdisabled rname; do
[ -n "${rid:-}" ] || continue
case "$rname" in
gcr-*) ;;
@@ -534,11 +534,23 @@ gcr_sweep_stale_runners() {
jid="${rest%-*}"
if ! gcr_record_exists_for_runner "$repo" "$rname"; then
gcr_log warn --ns=sweep "stale repo=$repo registration id=$rid name=$rname -> retire"
if gcr_gitea_deregister_runner_exact "$repo" "$rname"; then
gcr_event "stale-runner-deleted" "${jid:-unknown}" "{\"repo\":\"$repo\",\"runner_id\":$rid,\"name\":\"$rname\"}"
else
gcr_log error --ns=sweep "failed deleting repo=$repo runner id=$rid"
fi
stale_status=0
gcr_gitea_deregister_runner_exact "$repo" "$rname" \
|| stale_status="$?"
case "$stale_status" in
0)
gcr_event "stale-runner-deleted" "${jid:-unknown}" \
"{\"repo\":\"$repo\",\"runner_id\":$rid,\"name\":\"$rname\"}"
;;
2|3)
gcr_log info --ns=sweep \
"stale runner retirement pending repo=$repo runner id=$rid"
;;
*)
gcr_log error --ns=sweep \
"failed deleting repo=$repo runner id=$rid"
;;
esac
fi
done <<EOF
$runners