From 15e80d56c0aee28bd6fac7917e17080cefb3e1be Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Fri, 25 Sep 2026 18:51:30 -0400 Subject: [PATCH] fix(ci): report migrate run-task failures directly --- .github/workflows/deploy-api.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-api.yaml b/.github/workflows/deploy-api.yaml index 6b01871..0761dcc 100644 --- a/.github/workflows/deploy-api.yaml +++ b/.github/workflows/deploy-api.yaml @@ -216,13 +216,19 @@ jobs: export NET SUBNETS="$(python3 -c 'import json,os; print(",".join(json.loads(os.environ["NET"])["subnets"]))')" SGS="$(python3 -c 'import json,os; print(",".join(json.loads(os.environ["NET"])["securityGroups"]))')" - TASK_ARN="$(aws ecs run-task \ + RUN_JSON="$(aws ecs run-task \ --cluster "${CLUSTER}" \ --task-definition "${FAMILY}:${REV}" \ --launch-type FARGATE \ --network-configuration "awsvpcConfiguration={subnets=[${SUBNETS}],securityGroups=[${SGS}],assignPublicIp=ENABLED}" \ --overrides "{\"containerOverrides\":[{\"name\":\"${CONTAINER}\",\"command\":[\"node\",\"packages/api/dist/db/migrate.js\"],\"environment\":[{\"name\":\"DEV_AUTH_BYPASS\",\"value\":\"false\"}]}]}" \ - --query 'tasks[0].taskArn' --output text)" + --output json)" + TASK_ARN="$(printf '%s' "${RUN_JSON}" | python3 -c 'import json,sys; data=json.load(sys.stdin); tasks=data.get("tasks") or []; print(tasks[0].get("taskArn") or "" if tasks else "")')" + if [ -z "${TASK_ARN}" ] || [ "${TASK_ARN}" = "None" ]; then + echo "ecs run-task did not start a migrate task" >&2 + printf '%s' "${RUN_JSON}" | python3 -c 'import json,sys; data=json.load(sys.stdin); print(json.dumps(data.get("failures") or [], indent=2))' >&2 + exit 1 + fi aws ecs wait tasks-stopped --cluster "${CLUSTER}" --tasks "${TASK_ARN}" EXIT="$(aws ecs describe-tasks --cluster "${CLUSTER}" --tasks "${TASK_ARN}" \ --query 'tasks[0].containers[0].exitCode' --output text)"