Skip to content

Reset token in config template when set

Romuald Atchadé requested to merge runner-registration-token into main

What does this MR do?

When registering a new token, the user can provide a registration token and a runner token (willfully or not). As it stands, when a runner token has been provided, we verify if the token is valid with the following outcomes:

  • we fail the process if the registration token is not authenticated
  • we generate a new runner configuration using the same runner token

With this MR, when a runner token is provided, it is ignored and a new one is requested.

Why was this MR needed?

With this MR, we reset the token if found in the config template.

What's the best way to test this MR?

Config TOML template
[[runners]]
    url = "https://www.gitlab.com/"
    token = "fake-token"
    limit = 1
  1. Create a config template using the snippet above
  2. Generate a gitlab-runner executable from this MR with the following command
go build .
  1. Execute the following command
./gitlab-runner \
    --debug \
    register \
    --non-interactive \
    --url=https://gitlab.com/ \
    --template-config=PATH_TO_CONFIG_TMPL \
    --registration-token=REGISTRATION_TOKEN \
    --executor=shell

A config.toml will be generated with a new runner token

What are the relevant issue numbers?

close #28911 (closed)

Edited by Romuald Atchadé

Merge request reports