Hello in “/etc/gitlab-runner/config.toml” I have setup " MachineName = “GITLAB-RUNNER-%s”. When in our AWS environemnt new runner get started the have following names:
runner-51e4e52b-GITLAB-RUNNER-1535961601-d2e24b7b
runner-51e4e52b-GITLAB-RUNNER-1535961670-6d6bee30
It is possible to have named GITLAB-RUNNER-{NUMBER OR ID} ?
Greetings
Hi Roger,
a bit late, but I’ve just looked into this for a customer who had found your post while researching themselves, so maybe others will see the response here in the future as well:
In executors/docker/machine/name.go#L15 this runner-%something-%machinename
format is defined within the machineFormat()
function:
"runner-" + strings.ToLower(runner) + "-" + template
In executors/docker/machine/name.go#L21 we can see that dns.MakeRFC1123Compatible(config.ShortDescription())
is what is given into the machineFormat()
function as the runner
parameter.
So, what is config.ShortDescription()
? A quick look into common/config.go#L1603-1605 tells us that it simply is a shortened version of the Runner token (the exact shortening algorithm is defined in helpers/shorten_token.go#L7-20).
I don’t think there’s a way to get rid of the token-based prefix. I suspect this is used to differentiate between machines being spun up by different Runner managers. As such, there’s no need for the prefix in case you only have a single Runner manager, but as different Runner managers could run on completely independent machines from each other without knowing of their existence, it makes sense to have this always enabled.
2 Likes