From 89dcf6604a767c6b7d4f75663ff94daa9cc51486 Mon Sep 17 00:00:00 2001 From: Marvin Buss Date: Mon, 3 Jun 2024 11:14:08 +0200 Subject: [PATCH] Fetch Changes from Origin --- code/container/entrypoint.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/container/entrypoint.sh b/code/container/entrypoint.sh index 8673bdf..e62633e 100644 --- a/code/container/entrypoint.sh +++ b/code/container/entrypoint.sh @@ -11,8 +11,15 @@ export -n RUNNER_TOKEN export -n APP_ID export -n APP_PRIVATE_KEY +trap_with_arg() { + func="$1" ; shift + for sig ; do + trap "$func $sig" "$sig" + done +} + deregister_runner() { - echo "Caught SIGTERM. Deregistering runner" + echo "Caught $1 - Deregistering runner" if [[ -n "${ACCESS_TOKEN}" ]]; then _TOKEN=$(ACCESS_TOKEN="${ACCESS_TOKEN}" bash /token.sh) RUNNER_TOKEN=$(echo "${_TOKEN}" | jq -r .token) @@ -169,7 +176,7 @@ if [[ -n "${CONFIGURED_ACTIONS_RUNNER_FILES_DIR}" ]]; then fi if [[ ${_DISABLE_AUTOMATIC_DEREGISTRATION} == "false" ]]; then - trap deregister_runner SIGINT SIGQUIT SIGTERM INT TERM QUIT + trap_with_arg deregister_runner SIGINT SIGQUIT SIGTERM INT TERM QUIT fi # Start docker service if needed (e.g. for docker-in-docker)