Add systemID to Runner Helm Chart
Overview
GitLab Kubernetes integration - runner receives a new ID every time cluster is restarted leading to clutter in list of runners
I have a GitLab agent for integrating Kubernetes with our GitLab instance. It works fine and a registered runner is handling CI jobs as expected. However I couldn't help but notice that whenever the runner is re-deployed upon reboot, it receives a new ID. If one is to experiment with a cluster that is not running 24/7, this can quite fast lead to clutter in the runners list as seen below (I have two pages of the "same" runner):
Once a runner establishes a connection with the GitLab instance, the ID is entered into the list of runners. If the ID changes (as is the case described above), a new item is automatically added, while leaving the old one. I am currently running a script that uses the GitLab REST API and checks if a runner with a specific name (not ID) is offline and remove it automatically in order to cleanup. However, this seems to be easily avoidable if the ID was to remain the same especially since the same applies to the name of the runner.
Proposal
The final proposal combines the ideas mentioned in these two comments:
- This comment suggests generating a string, possibly using a sha256 hash of Release.Name + Release.Namespace, or a CRC32/64 if an integer value is used. The template functions available will determine the specific approach.
-
The second comment outlines the string format, which should adhere to a given regex. If it's generated from the host system ID, it should start with s_, and if it's random, it should start with r_. Additionally, it should be followed by a 12-character hash of the ID, following the provided link. In our case it would be an
r_