Skip to content

Commit 718d018

Browse files
authored
fix: check for any non-zero container error (#23)
* fix: check for any non-zero container error * fix: obtain exit code during check of task
1 parent 0356ad2 commit 718d018

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

deploy.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@ if [ -n "$INPUT_PREPARE_TASK_CONTAINER_IMAGE_CHANGES" ] && [ -n "$INPUT_PREPARE_
244244
waitOnTask "$TASK_ARN"
245245

246246
TASK_RESPONSE=$(describeTask "$TASK_ARN")
247-
EXIT_CODE=$(echo "$TASK_RESPONSE" | jq -r '.tasks[0]?.containers[0]?.exitCode // 255')
247+
if echo "$TASK_RESPONSE" | jq -e '.tasks[0].containers[] | select((.exitCode // 255) != 0)' > /dev/null; then
248+
EXIT_CODE=$(echo "$TASK_RESPONSE" | jq -r '.tasks[0].containers[] | select((.exitCode // 255) != 0) | .exitCode // 255')
248249

249-
if [ "$EXIT_CODE" -eq 0 ]; then
250-
echo -e "${GREEN}Task has executed successfully.";
251-
else
252250
echo -e "${RED}Task returned non-zero exit code: ${RESET_TEXT}$EXIT_CODE. Raw response is below:";
253251
echo -e "${TASK_RESPONSE}"
254252
exit 1;
253+
else
254+
echo -e "${GREEN}Task has executed successfully.";
255255
fi
256256
fi
257257

0 commit comments

Comments
 (0)