66# BASE_REVISION - revision of cardano-node to upgrade from (alternative to BASE_TAR_URL)
77# UPGRADE_REVISION - revision of cardano-node to upgrade to
88
9- set -euo pipefail
9+ set -Eeuo pipefail
10+ trap ' echo "Error at line $LINENO"' ERR
1011
1112if [[ -z " ${BASE_TAR_URL:- " " } " && -z " ${BASE_REVISION:- " " } " ]]; then
1213 echo " BASE_TAR_URL or BASE_REVISION must be set"
1617nix --version
1718df -h .
1819
20+ retval=0
21+
1922REPODIR=" $( readlink -m " ${0%/* } /.." ) "
2023export REPODIR
2124cd " $REPODIR "
@@ -27,13 +30,15 @@ export WORKDIR="$REPODIR/run_workdir"
2730
2831_cleanup () {
2932 # stop all running cluster instances
30- stop_instances " $WORKDIR "
33+ stop_instances " $WORKDIR " || :
3134}
3235
3336_cleanup
3437
3538# cleanup on Ctrl+C
36- trap ' set +e; _cleanup; exit 130' SIGINT
39+ trap ' _cleanup; exit 130' SIGINT
40+ # cleanup on error
41+ trap ' echo "Error at line $LINENO"; _cleanup' ERR
3742
3843# create clean workdir
3944rm -rf " ${WORKDIR:? } "
7883 NODE_OVERRIDE=$( node_override)
7984fi
8085
81- set +e
8286# shellcheck disable=SC2086
8387nix flake update --accept-flake-config $NODE_OVERRIDE
8488# shellcheck disable=SC2016
8589nix develop --accept-flake-config .# venv --command bash -c '
90+ set -euo pipefail
8691 : > " $WORKDIR /.nix_step1"
8792 echo " ::endgroup::" # end group for "Nix env setup step1"
8893
@@ -95,9 +100,10 @@ nix develop --accept-flake-config .#venv --command bash -c '
95100 printf " start: %(%H:%M:%S)T\n" -1
96101 df -h .
97102 # prepare scripts for stating cluster instance, start cluster instance, run smoke tests
98- ./.github/node_upgrade_pytest.sh step1
99- '
100- retval="$?"
103+ retval=0
104+ ./.github/node_upgrade_pytest.sh step1 || retval=" $? "
105+ exit " $retval "
106+ ' || retval="$?"
101107
102108if [ ! -e "$WORKDIR/.nix_step1" ]; then
103109 echo "Nix env setup failed, exiting"
123129nix flake update --accept-flake-config $NODE_OVERRIDE
124130# shellcheck disable=SC2016
125131nix develop --accept-flake-config .# venv --command bash -c '
132+ set -euo pipefail
126133 : > " $WORKDIR /.nix_step2"
127134 echo " ::endgroup::" # end group for "Nix env setup steps 2 & 3"
128135
@@ -135,8 +142,8 @@ nix develop --accept-flake-config .#venv --command bash -c '
135142 printf " start: %(%H:%M:%S)T\n" -1
136143 df -h .
137144 # update cluster nodes, run smoke tests
138- ./.github/node_upgrade_pytest.sh step2
139- retval=" $? "
145+ retval=0
146+ ./.github/node_upgrade_pytest.sh step2 || retval=" $? "
140147 # retval 0 == all tests passed; 1 == some tests failed; > 1 == some runtime error and we dont want to continue
141148 [ " $retval " -le 1 ] || exit " $retval "
142149 echo " ::endgroup::" # end group for "Testrun Step2"
@@ -145,35 +152,32 @@ nix develop --accept-flake-config .#venv --command bash -c '
145152 printf " start: %(%H:%M:%S)T\n" -1
146153 df -h .
147154 # update to Conway, run smoke tests
148- ./.github/node_upgrade_pytest.sh step3
149- retval=" $? "
155+ retval=0
156+ ./.github/node_upgrade_pytest.sh step3 || retval=" $? "
150157 df -h .
151158 echo " ::endgroup::" # end group for "Testrun Step3"
152159
153160 echo " ::group::Teardown cluster & collect artifacts"
154161 printf " start: %(%H:%M:%S)T\n" -1
155162 # teardown cluster
156- ./.github/node_upgrade_pytest.sh finish
163+ ./.github/node_upgrade_pytest.sh finish || :
157164 exit $retval
158- '
159- retval="$?"
165+ ' || retval="$?"
160166
161167if [ ! -e "$WORKDIR/.nix_step2" ]; then
162168 echo "Nix env setup failed, exiting"
163169 exit 1
164170fi
165171
166172# grep testing artifacts for errors
167- # shellcheck disable=SC1090,SC1091
168- . .github/grep_errors.sh
173+ ./.github/grep_errors.sh
169174
170175_cleanup
171176
172177# prepare artifacts for upload in Github Actions
173178if [ -n "${GITHUB_ACTIONS:-""}" ]; then
174179 # save testing artifacts
175- # shellcheck disable=SC1090,SC1091
176- . .github/save_artifacts.sh
180+ ./.github/save_artifacts.sh
177181
178182 # compress scheduling log
179183 xz "$SCHEDULING_LOG"
0 commit comments