Ensure each runner has a unique system ID assigned
What does this MR do?
This MR changes the config load/save logic in the runner so that we are guaranteed to have a unique system ID assigned to each [[runners]]
entry.
Why was this MR needed?
This will allow us to distinguish between runners using the same runner token, as per https://docs.gitlab.com/ee/architecture/blueprints/runner_tokens/#runner-identification-in-ci-jobs
What's the best way to test this MR?
- Build
gitlab-runner
- Open the
config.toml
file - Run a command, such as
gitlab-runner run
- Notice the file being populated with a
unique_system_id
property for each runner - If you remove a
unique_system_id
entry and save the file, a new value will be automatically populated.
Notes
If there are any duplicates inside the same toml file, it is expected that the first is preserved and the following ones will be regenerated. In the end, it wouldn't really matter if they are duplicated since it is the runner token + unique system ID that identifies a runner, but this makes the unique system ID more reliably unique.
What are the relevant issue numbers?
Closes Ensure all runner entries in config.toml have u... (#29388 - closed)
Edited by Pedro Pombeiro