mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-01 01:33:18 +00:00
fix(ci): report migrate run-task failures directly
This commit is contained in:
parent
91e8740eca
commit
15e80d56c0
1 changed files with 8 additions and 2 deletions
10
.github/workflows/deploy-api.yaml
vendored
10
.github/workflows/deploy-api.yaml
vendored
|
|
@ -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)"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue