Skip to content

Commit

Permalink
Added better exit code checks for CIV execution.
Browse files Browse the repository at this point in the history
This allows the aws.sh script to finish gracefully in the event no test
cases were collected because the filters used actually did not select any
applicable test (e.g. "pub" marked tests for Image Builder internal CI).

Also added extra checks for infrastructure-related issues such as when
CIV exits with code 100 (introduced by us to identify deployment issues).
  • Loading branch information
narmaku committed Sep 27, 2024
1 parent b2555c6 commit c7d57fa
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions ci/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ sudo "${CONTAINER_RUNTIME}" run \
-v "${TEMPDIR}":/tmp:Z \
"${CONTAINER_CLOUD_IMAGE_VAL}" \
python cloud-image-val.py \
-c /tmp/civ_config.yml \
&& RESULTS=1 || RESULTS=0
-c /tmp/civ_config.yml

CIV_EXIT_CODE=$?

mv "${TEMPDIR}"/report.html "${ARTIFACTS}"

Expand All @@ -306,12 +307,23 @@ sudo composer-cli compose delete "${COMPOSE_ID}" > /dev/null

# Use the return code of the smoke test to determine if we passed or failed.
# On rhel continue with the cloudapi test
if [[ $RESULTS == 1 ]]; then
greenprint "πŸ’š Success"
exit 0
elif [[ $RESULTS != 1 ]]; then
redprint "❌ Failed"
exit 1
fi

exit 0
case $CIV_EXIT_CODE in
0)
greenprint "πŸ’š Success"
exit 0
;;
5)
echo "❗ No tests were run"
exit 0
;;
100)
redprint "❌ Failed (cloud deployment/destroy issues)"
exit 1
;;
*)
redprint "❌ Failed (exit code: ${CIV_EXIT_CODE})"
exit 1
;;
esac

exit 0

0 comments on commit c7d57fa

Please sign in to comment.