From d79d62c63804e63389c0baafeccf95177d89b2b6 Mon Sep 17 00:00:00 2001 From: David Heidelberg Date: Sat, 4 Mar 2023 20:40:48 +0100 Subject: [PATCH] ci: do not exit when an error happens inside the section Let CI handle that case as it did before. The only thing which needs to be done by the error() function is to get out of the section. Fixes the issue where a job is not saving artifacts after failure. Fixes: 4cc0cec47357 ("ci: implement unified sections") Acked-by: Guilherme Gallo Signed-off-by: David Heidelberg Part-of: --- .gitlab-ci/setup-test-env.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci/setup-test-env.sh b/.gitlab-ci/setup-test-env.sh index ff8d676ec04..8f61f9b0c6f 100644 --- a/.gitlab-ci/setup-test-env.sh +++ b/.gitlab-ci/setup-test-env.sh @@ -26,11 +26,8 @@ function error { [ "$state_x" -eq 0 ] || set -x } -function trap_exit { - local ret=$1 - shift - error $CURRENT_SECTION: $* - exit $ret +function trap_err { + error ${CURRENT_SECTION:-'unknown-section'}: ret code: $* } function build_section_start { @@ -88,7 +85,7 @@ function uncollapsed_section_switch { export -f x_off export -f error -export -f trap_exit +export -f trap_err export -f build_section_start export -f section_start export -f build_section_end @@ -97,4 +94,4 @@ export -f section_switch export -f uncollapsed_section_switch set -E -trap 'trap_exit $?' ERR +trap 'trap_err $?' ERR