fix: gitea controller
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user