diff --git a/deploy.sh b/deploy.sh index fadda9e..bd5aefd 100755 --- a/deploy.sh +++ b/deploy.sh @@ -244,14 +244,14 @@ if [ -n "$INPUT_PREPARE_TASK_CONTAINER_IMAGE_CHANGES" ] && [ -n "$INPUT_PREPARE_ waitOnTask "$TASK_ARN" TASK_RESPONSE=$(describeTask "$TASK_ARN") - EXIT_CODE=$(echo "$TASK_RESPONSE" | jq -r '.tasks[0]?.containers[0]?.exitCode // 255') + if echo "$TASK_RESPONSE" | jq -e '.tasks[0].containers[] | select((.exitCode // 255) != 0)' > /dev/null; then + EXIT_CODE=$(echo "$TASK_RESPONSE" | jq -r '.tasks[0].containers[] | select((.exitCode // 255) != 0) | .exitCode // 255') - if [ "$EXIT_CODE" -eq 0 ]; then - echo -e "${GREEN}Task has executed successfully."; - else echo -e "${RED}Task returned non-zero exit code: ${RESET_TEXT}$EXIT_CODE. Raw response is below:"; echo -e "${TASK_RESPONSE}" exit 1; + else + echo -e "${GREEN}Task has executed successfully."; fi fi