Generate global system ID
What does this MR do?
This MR adds a new .runner_system_id
sidecar file and changes the config load logic in the runner so that we are guaranteed to have a system ID assigned in .runner_system_id
.
It leverages the cross-platform https://github.com/denisbrodbeck/machineid library to return a stable machine identifier, and if not available (e.g. in containers), it will generate a random identifier.
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
It will also provide a foundation for settings that should not be copied across machines.
What's the best way to test this MR?
- Build
gitlab-runner
- Run a command, such as
gitlab-runner run
- Open the
.runner_system_id
file (located in the same directory as theconfig.toml
) - Notice the file being populated with the
system_id
property value - If you remove the value (or the file) and restart the app or reload the config with
kill -SIGHUP <pid>
, a new value will be automatically populated. - Run
gitlab-runner register
- The new runner token is output together with the system ID
What are the relevant issue numbers?
Closes Add unique machine identifier values to gitlab-... (#28912 - closed)
Edited by Pedro Pombeiro