From d4c664a67029440a0d53d70e2387f87c6eba0453 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 1 Jun 2022 12:29:07 -0700 Subject: [PATCH] ci: Terminate capture-devcoredump before tarring up artifacts. Every few weeks we'd get a flake where the script noticed the devcore right as we were wrapping up, and then tar would exit because the file it was tarring changed underneath it. Just kill devcores before we do that -- even if we kill it while it's working, it's so rare that it probably won't bother anyone. Fixes: #5867 Part-of: --- .gitlab-ci/common/init-stage2.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci/common/init-stage2.sh b/.gitlab-ci/common/init-stage2.sh index 769b4c7355f..2f6f498c9d6 100755 --- a/.gitlab-ci/common/init-stage2.sh +++ b/.gitlab-ci/common/init-stage2.sh @@ -4,11 +4,15 @@ # exiting, since any console output may interfere with LAVA signals handling, # which based on the log console. cleanup() { + if [ "$BACKGROUND_PIDS" = "" ]; then + return 0 + fi + set +x echo "Killing all child processes" for pid in $BACKGROUND_PIDS do - kill "$pid" + kill "$pid" 2>/dev/null || true done # Sleep just a little to give enough time for subprocesses to be gracefully @@ -18,6 +22,9 @@ cleanup() { do kill -9 "$pid" 2>/dev/null || true done + + BACKGROUND_PIDS= + set -x } trap cleanup INT TERM EXIT @@ -135,6 +142,11 @@ mv -f ${CI_PROJECT_DIR}/results ./ 2>/dev/null || true [ ${EXIT_CODE} -ne 0 ] || rm -rf results/trace/"$PIGLIT_REPLAY_DEVICE_NAME" +# Make sure that capture-devcoredump is done before we start trying to tar up +# artifacts -- if it's writing while tar is reading, tar will throw an error and +# kill the job. +cleanup + # upload artifacts if [ -n "$MINIO_RESULTS_UPLOAD" ]; then tar -czf results.tar.gz results/;