File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,3 +233,15 @@ jobs:
233233 -e EPHEMERAL=true \
234234 -e DISABLE_AUTO_UPDATE=true \
235235 ${GH_RUNNER_IMAGE} 10
236+
237+ - name : Test EXIT trap on crash
238+ run : |
239+ # Run the container with a dummy token and force it to exit with code 1
240+ docker run --name trap-test \
241+ -e REPO_URL=https://github.com/fake/repo \
242+ -e RUNNER_TOKEN=faketoken \
243+ -e DISABLE_AUTOMATIC_DEREGISTRATION=false \
244+ ${GH_RUNNER_IMAGE} /bin/bash -c "exit 1" || true
245+
246+ # Check the logs to ensure the trap fired
247+ docker logs trap-test | grep "Caught EXIT - Deregistering runner"
Original file line number Diff line number Diff line change 236236
237237if [[ ${_DISABLE_AUTOMATIC_DEREGISTRATION} == " false" ]]; then
238238 if [[ ${_DEBUG_ONLY} == " false" ]]; then
239- trap_with_arg deregister_runner SIGINT SIGQUIT SIGTERM INT TERM QUIT
239+ trap_with_arg deregister_runner SIGINT SIGQUIT SIGTERM INT TERM QUIT EXIT
240240 fi
241241fi
242242
You can’t perform that action at this time.
0 commit comments