diff --git a/packages/ecr-run-task/action.yml b/packages/ecr-run-task/action.yml index 7d498c5..03fcca0 100644 --- a/packages/ecr-run-task/action.yml +++ b/packages/ecr-run-task/action.yml @@ -127,3 +127,17 @@ runs: --start-time $START_TIME \ --end-time $END_TIME \ | jq -r '.events[].message' + + # Get exit code + TASK_EXIT_CODE=$( + aws ecs describe-tasks \ + --cluster $APP_ENV-cluster \ + --tasks $TASK_ID \ + --query "tasks[0].containers[?name=='$CONTAINER_NAME'].exitCode" \ + --output text) + + echo "Task exit code is $TASK_EXIT_CODE" + + # exit with the same code + # if this fails, we should not continue with rest of the deployment + exit $TASK_EXIT_CODE