Skip to content

Disallow runner registration if allow_runner_registration_token disabled

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR updates the Ci::Runners::RegisterRunnerService class to take the instance and namespace allow_runner_registration_token settings into account. This is described in the architecture blueprint https://docs.gitlab.com/ee/architecture/blueprints/runner_tokens/#details:

image

Part of #404804 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Disable setting in Rails console:

    group = Group::last
    group.update!(allow_runner_registration_token: false)
  2. Try to register a runner using the registration token (can be retrieved using group.runners_token). You should receive an error:

    gitlab-runner register  --url http://gdk.test:3000 --executor shell --non-interactive --registration-token "$REGISTRATION_TOKEN"

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pedro Pombeiro

Merge request reports

Loading