From 40b9840f65c58b45984a30ab87bce1186ddff6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Fr=C3=A9con?= Date: Fri, 16 Feb 2024 23:08:58 +0100 Subject: [PATCH] Prevent loop break on regular exit --- runner/runner.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runner/runner.sh b/runner/runner.sh index 707039c..0e96238 100755 --- a/runner/runner.sh +++ b/runner/runner.sh @@ -253,7 +253,7 @@ runner_unregister() { verbose "Removed runner token file at $RUNNER_TOKENFILE" fi - if [ -n "${RUNNER_TOKENFILE:-}" ] && [ -n "${RUNNER_SECRET:-}" ]; then + if [ "${1:-0}" = 1 ] && [ -n "${RUNNER_TOKENFILE:-}" ] && [ -n "${RUNNER_SECRET:-}" ]; then printf %s\\n "$RUNNER_SECRET" > "${RUNNER_TOKENFILE%.*}.brk" fi } @@ -394,7 +394,8 @@ if [ "$#" = 0 ]; then fi # Capture termination signals -trap runner_unregister INT TERM EXIT +trap 'runner_unregister 1' INT TERM +trap 'runner_unregister 0' EXIT # Start the docker daemon. Prefer podman if available (it will be the only one # available, unless the dockerd is installed in the future)