GitLab Runner registration workflow

GitLab Runner need for each one own IP/Hardware?

One thing with GitLab Runner I do not understand. Can I register one dedicated Runner (Hardware) to different Projects?
As sample I have following Gitlab Runners

  • gitlab-runner-1
  • gitlab-runner-2
  • gitlab-runner-shared-1
  • gitlab-runner-shared-2

gitlab-runner-1 is bound to project 1 with project token
gitlab-runner-2 is bound to project 2 with project token

Each runner is shown inside the project and on the left side the shared runners.

My Question is now, do I need for each project one hardware runner or can I register one runner with multiple projects. Like register project 1 on gitlab-runner 1 and als register project 2 on gitlabe-runner 1 too? Or will this double register overwrite the previous registration?

Hey there,

What you want, I believe, is an instance or group runner.

Instance runner - you can register from Admin panel on your instance. It has access to all projects on your instance.

Group runner - you can register from Group settings (CI/CD > Runners). It has access to projects of that group.

From Registering runners | GitLab :

Before registering a runner, you must first:

  • Install it on a server separate than where GitLab is installed
  • Obtain a token:
    • For a shared runner, have an administrator go to the GitLab Admin Area and select Overview > Runners
    • For a group runner, go to CI/CD > Runners
    • For a project runner, go to Settings > CI/CD and expand the Runners section

Basically, it comes down to taking this token from different places. In your case, I believe you can just delete the Runner from the UI and then repeat registration process with new registration token.

Hope this helps!

1 Like

So in all, each runner allows only one registration?

Yes, I believe so :slight_smile:

Then please explain why the config.toml can container multiple runners. That is wired. So maybe your answers are wrong?

Because you can have multiple runners (services) on one (runner) server.

I have pointed out that there is some potential for confusion due to the naming here.

1 Like

Hi, using an API call at project level with the project runner registration token you may create runner access tokens, see Runners API | GitLab. So create two access tokens using the two different registration tokens of the projects and use them in the corresponding section of the config.toml.

You may reuse the same hardware but keep in mind that then jobs may interfere unless you use docker runners. This may be useful if you want to share special GPUs, e.g.