Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/deploy-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down