machulav / ec2-github-runner

On-demand self-hosted AWS EC2 runner for GitHub Actions
MIT License
745 stars 331 forks source link

Runners fail to register when IPs/hostnames are reused #128

Open jeverling opened 1 year ago

jeverling commented 1 year ago

It seems that Github runners use the hostname as runner --name by default. This lead to runner instances not being able to register for us, because AWS was re-using internal IP addresses. Setting runner --name explicitly to a unique value should fix this.

karuppiah7890 commented 1 year ago

@jeverling I'm curious as to how this happened. Even if AWS was reusing internal IP addresses, and EC2 host names are based on it's private IP address, it can only cause two different EC2 hosts at different points in time to have the same host name. If that is the case, what's the problem here? Does GitHub expect new names every time a runner registers to GitHub and not reuse any old names used by old runners that don't exist anymore?

jeverling commented 1 year ago

Does GitHub expect new names every time a runner registers to GitHub and not reuse any old names used by old runners that don't exist anymore?

Exactly, Github keeps a registry of runners, and refuses registering a runner with a name that has been used before. It might be possible to deregister runners or solve this in other ways, but I think using unique names for runners isn't a bad solution to this problem.

karuppiah7890 commented 1 year ago

yeah, deregistering is a good way to solve the problem

karuppiah7890 commented 1 year ago

Unique name is good in general 👍 I'm gonna use your solution for unique name