ci-automation: Return 1 on broken cycle

We have set success to true when the test cycle was broken, which was
a hacky way to avoid printing the give up message. But this setting
success to true also meant that the script returned with status 0,
which is wrong.

Add another variable for controlling printing the give up message.
This commit is contained in:
Krzesimir Nowak 2022-08-30 11:24:32 +02:00
parent 6c77ebde54
commit 9e05a07a77

View File

@ -154,6 +154,7 @@ function _test_run_impl() {
local tap_merged_detailed="results-${image}-detailed.tap" local tap_merged_detailed="results-${image}-detailed.tap"
local retry="" local retry=""
local success=false local success=false
local print_give_up=true
# A job on each worker prunes old mantle images (docker image prune) # A job on each worker prunes old mantle images (docker image prune)
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
@ -193,6 +194,7 @@ function _test_run_impl() {
if [ -z "$failed_tests" ] ; then if [ -z "$failed_tests" ] ; then
echo "########### All tests succeeded. ###########" echo "########### All tests succeeded. ###########"
success=true success=true
print_give_up=false
break break
fi fi
@ -200,9 +202,7 @@ function _test_run_impl() {
echo "########### Test cycle requested to break ###########" echo "########### Test cycle requested to break ###########"
echo "Failed tests: $failed_tests" echo "Failed tests: $failed_tests"
echo "-----------" echo "-----------"
# not really a success, but don't print a message about print_give_up=false
# exhaused reruns and giving up
success=true
break break
fi fi
@ -213,7 +213,7 @@ function _test_run_impl() {
done done
if ! $success; then if ${print_give_up}; then
echo "########### All re-runs exhausted ($retries). Giving up. ###########" echo "########### All re-runs exhausted ($retries). Giving up. ###########"
fi fi