Newskooler
Newskooler

Reputation: 4255

How to change a shared gitlab runner token?

I have one shared GitLab runner. To verify this I run the following command:

sudo gitlab-runner list

Which shows something like this:

Runtime platform                arch=amd64 os=linux pid=28276 revision=c127439c version=13.0.0
Listing configured runners      ConfigFile=/etc/gitlab-runner/config.toml
Shared shell runner - 1         Executor=shell Token=5_JqpessGzXasyqRyBP5 URL=https://gitlab.mysite.com/

I have a new GitLab instance and need to re-assign the runner to the new instance. This means a new token (the URL is the same).

Solution 1

I simply ran sudo gitlab-runner verify --delete and then registed a new runner. Clearly not ideal, though it works.

Solution 2

A second solution I thought about was to go in the /etc/gitlab-runner/config.toml and change the token, but this did not work for some reason. I believe it did not work, because when I ran sudo gitlab-runner verify it failed. I guess it's possible my issue was elsewhere...?

How can I achieve this?

Upvotes: 3

Views: 4557

Answers (1)

monofone
monofone

Reputation: 860

You need to unregister the runner, they are "throw away instances". Then you need to take a look into the Runners section of Gitlab admin panel. There you will find a token to register a new shared runner.

While registering the runner, the runner will get his own token to authenticate against Gitlab. This token has nothing to do with the registration token in the Runners section in the admin panel.

Upvotes: 3

Related Questions