fix: gitea controller
This commit is contained in:
@@ -321,6 +321,8 @@ gcr_handle_webhook() {
|
||||
conclusion="$(printf '%s' "$gcr_body" | jq -r '.workflow_job.conclusion // ""')"
|
||||
repo="$(printf '%s' "$gcr_body" | jq -r '.repository.full_name // ""')"
|
||||
labels_json="$(printf '%s' "$gcr_body" | jq -c '.workflow_job.labels // []')"
|
||||
runner_id="$(printf '%s' "$gcr_body" | jq -r '.workflow_job.runner_id // ""')"
|
||||
runner_name="$(printf '%s' "$gcr_body" | jq -r '.workflow_job.runner_name // ""')"
|
||||
|
||||
[ -n "$action" ] && [ -n "$repo" ] \
|
||||
|| { gcr_respond 400 "malformed payload"; exit 0; }
|
||||
@@ -336,12 +338,25 @@ gcr_handle_webhook() {
|
||||
gcr_log info --ns=alloc "queued job=$job_id repo=$repo code=$RESPONSE_CODE $RESPONSE_BODY"
|
||||
;;
|
||||
in_progress)
|
||||
gcr_mark_in_progress "$job_id" "$attempt" "$repo"
|
||||
case "$runner_id" in
|
||||
''|0|*[!0-9]*) gcr_respond 400 "malformed runner identity"; exit 0 ;;
|
||||
esac
|
||||
if ! gcr_apply_actual_job "$repo" "$runner_id" "$runner_name" \
|
||||
"$job_id" "$attempt" vm_active webhook; then
|
||||
gcr_log warn --ns=alloc \
|
||||
"unresolved in-progress assignment job=$job_id repo=$repo runner_id=$runner_id"
|
||||
fi
|
||||
RESPONSE_CODE=204
|
||||
;;
|
||||
completed)
|
||||
gcr_deallocate "$job_id" "$attempt" \
|
||||
"completed:${conclusion:-unknown}" "$repo"
|
||||
case "$runner_id" in
|
||||
''|0|*[!0-9]*) gcr_respond 400 "malformed runner identity"; exit 0 ;;
|
||||
esac
|
||||
if ! gcr_apply_actual_job "$repo" "$runner_id" "$runner_name" \
|
||||
"$job_id" "$attempt" "completed:${conclusion:-unknown}" webhook; then
|
||||
gcr_log warn --ns=alloc \
|
||||
"unresolved terminal assignment job=$job_id repo=$repo runner_id=$runner_id"
|
||||
fi
|
||||
RESPONSE_CODE=204
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user