From 3cb769f038164f052e7d54ac16706da588b9628d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henry=20Gr=C3=A6sberg?= Date: Sun, 22 Nov 2026 17:55:31 +0100 Subject: [PATCH] Fix migrate-job polling query in CI The execution objects from `az containerapp job execution list` nest startTime/status under `properties`, so sort_by(&startTime) saw a null sort key and JMESPath rejected it. Capture the execution name from `job start` and poll that exact execution with `job execution show` instead. --- .github/workflows/deploy-azure.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-azure.yaml b/.github/workflows/deploy-azure.yaml index df6c54c..2d10c2f 100644 --- a/.github/workflows/deploy-azure.yaml +++ b/.github/workflows/deploy-azure.yaml @@ -144,12 +144,18 @@ jobs: # start it with no overrides so the full job template applies. az containerapp job update -n "$MIGRATE_JOB" -g "$RESOURCE_GROUP" \ --image "$ACR_SERVER/gspotter-backend:$GITHUB_SHA" - az containerapp job start -n "$MIGRATE_JOB" -g "$RESOURCE_GROUP" - - # Poll the newest execution until it finishes. + EXECUTION="$(az containerapp job start -n "$MIGRATE_JOB" -g "$RESOURCE_GROUP" \ + --query name -o tsv)" + echo "Migration execution: $EXECUTION" + + # Poll that exact execution until it finishes. (Do not use + # `job execution list` + sort_by(&startTime): those fields are nested + # under `properties`, so a top-level sort key is null and JMESPath + # rejects it.) for _ in $(seq 1 60); do - STATUS="$(az containerapp job execution list -n "$MIGRATE_JOB" -g "$RESOURCE_GROUP" \ - --query 'sort_by(@, &startTime)[-1].status' -o tsv)" + STATUS="$(az containerapp job execution show -n "$MIGRATE_JOB" -g "$RESOURCE_GROUP" \ + --job-execution-name "$EXECUTION" \ + --query properties.status -o tsv 2>/dev/null || true)" case "$STATUS" in Succeeded) echo "Migrations applied."; exit 0 ;; Failed) echo "Migration job failed. See: az containerapp job execution logs" >&2; exit 1 ;;