Remove runner from GitHub without uninstall - or make uninstall faster
See original GitHub issueAllow to remove runner from GitHub without uninstall - or make uninstall faster (<30s)
When running shutdown script on preemptible GCP hosts, it never removes the runner from GitHub because it takes longer than the preemptible shutdown periods (30s).
When I execute the shutdown script with svc.sh uninstall
it always takes over 32s to execute, which is longer than the VM host has to shutdown (example of timer below).
It should be possible to remove the runner from GitHub without having to uninstall the service, or at least, to be faster to do it.
EDIT/UPDATE: I’m running a MIG on GCP based on a preemptible node pool, where every machine gets destroyed, so when it goes down, I don’t need to keep runner on it. Whenever a new host comes back up, it will execute the startup script and install the runner brand new (with the --replace flag).
Code Snippet
When running the remove without svc.sh uninstall
:
RUNNER_ALLOW_RUNASROOT=1 ./config.sh remove --token $REMOVE_TOKEN --unattended
# Runner removal
Removing service
Failed: Removing service
Unconfigure service first
When executing the script:
# time ./remove_script.sh
Removing runner vm-gh-runner-4zjb @
Generating a removal token...
Attempting to remove Runner from GitHub
/runner /
(...)
# Runner removal
√ Runner removed successfully
√ Removed .credentials
√ Removed .runner
real 0m32.833s
user 0m1.220s
sys 0m0.079s
Additional information GCP Documentation for shutdown periods: https://cloud.google.com/compute/docs/shutdownscript
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
Fixed by https://github.com/actions/runner/pull/1580
Uninstall should be much much quicker, we no longer wait 30 seconds
I think
svc.sh uninstall
just run a bunch ofsystemctl
commands to remove thesystemd
service, so we might not able to speed that up.do you need to un-configure the runner when the machine goes down and is destroyed? If you are re-using the same runner name, pass
--replace
during runner configure will overwrite the existing runner.We have a feature that allows a runner to only take one job and unconfig itself at the end of the job coming soon https://github.com/actions/runner/pull/660, feels like you can leverage that in the future.
In the meantime, you can just skip unconfigure the runner, the only problem it will cause is you will have a bunch of offline runners shows up in the web UI. (The service will delete those after 30 days of inactive.)