]> xenbits.xensource.com Git - xen-guest-agent.git/commitdiff
ci: make sure collapsed-section footer is always printed
authorYann Dirson <yann.dirson@vates.fr>
Fri, 1 Dec 2023 09:57:38 +0000 (10:57 +0100)
committerYann Dirson <yann.dirson@vates.fr>
Fri, 1 Dec 2023 11:22:25 +0000 (12:22 +0100)
In case of error the lack of footer would fool gitlab log display into
thinking error summary from git-rebase was part of the collapsible section,
which is confusing to the reader.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
devscripts/gitlab-ci-runbuild.sh

index ce60a70c1b5ec8fb2d88f1339bfebbbb251603cb..474bda12f8fdd75697be1bdca83a18d186ac847e 100755 (executable)
@@ -11,6 +11,9 @@ COLLAPSED_TITLE="$(git log -1 --oneline)"
 
 # collapsable header
 printf "\e[0Ksection_start:$(date +%s):${FOOTER_ID}[collapsed=true]\r\e[0K\e[1;33m${COLLAPSED_TITLE}\e[1;0m\n"
+# collapsable footer, stopping traces first
+trap 'set +x; printf "\e[0Ksection_end:$(date +%s):${FOOTER_ID}\r\e[0K\n"' EXIT
+
 # trace, but not outside of collapsed section
 set -x
 
@@ -29,10 +32,5 @@ else
     esac
 fi
 
-# stop traces before closing collapsed section
-set +x
-# collapsable footer
-printf "\e[0Ksection_end:$(date +%s):${FOOTER_ID}\r\e[0K\n"
-
 # make any ignored error visible outside of collapsed section
 [ $IGNORED_ERROR = 0 ] || printf "\e[1;31mIgnoring failure for WIP commit\e[1;0m\n"