question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove runner from GitHub without uninstall - or make uninstall faster

See original GitHub issue

Allow 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thboopcommented, Feb 1, 2022

Fixed by https://github.com/actions/runner/pull/1580

Uninstall should be much much quicker, we no longer wait 30 seconds

1reaction
TingluoHuangcommented, Sep 3, 2021

I think svc.sh uninstall just run a bunch of systemctl commands to remove the systemd 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.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removing self-hosted runners
An ephemeral self-hosted runner is automatically removed from GitHub if it has not connected to GitHub Actions for more than 1 day. Just-in-time...
Read more >
Runner removal
config.sh remove Runner removal Removing service Failed: Removing service ... That means either svc.sh uninstall exits without deleting ...
Read more >
Removing runner from host *after* force removal in github
So, right now I have a Linux host with a runner installed, but not registered in github. If I run ./config --url https://github.com/MY_ORG...
Read more >
Removing self hosted runner from deleted repository #26297
On the runner server just remove the whole actions-runner directory. Then do all the steps to add a new runner again, as shown...
Read more >
Removing self-hosted runners - GitHub Enterprise Cloud ...
An ephemeral self-hosted runner is automatically removed from GitHub Enterprise Cloud if it has not connected to GitHub Actions for more than 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found