Can't enable Shared Runners in the project because of MaxBuilds

I create Instance Runner

sudo gitlab-runner register --executor "docker" \
  --docker-image="docker:stable" \
  --url "https://gitlab.mydomain.com/" \
  --description "sonarqube-runner docker" \
  --tag-list "sonarqube" \
  --locked="false" \
  --access-level="not_protected" \
  --docker-volumes "/cache"\
  --docker-volumes "/tmp/builds:/tmp/builds"\
  --docker-volumes "/var/run/docker.sock:/var/run/docker.sock" \
  --registration-token="GR1348941LE7yfKPjoLBSoE-WTy4A" \
  --non-interactive\
  --builds-dir "/tmp/builds"

But when I want to see the status of that runner in a particular project, I see that Shared runners = Disabled and a message: “The same shared runner executes code from multiple projects, unless you configure autoscaling with MaxBuilds set to 1 (which it is on GitLab.com).”

I changed the runner configuration (MaxBuilds = 20) in config.toml but that did NOT help.

sudo nano /etc/gitlab-runner/config.toml
sudo systemctl restart gitlab-runner.service
[[runners]]
  name = "sonarqube-runner docker"
  url = "https://gitlab.mydomain.com/"
  token = "E5uwTkdB777Jti6rnusi"
  executor = "docker"
  builds_dir = "/tmp/builds"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache", "/tmp/builds:/tmp/builds", "/var/run/docker.sock:/var/run/docker.sock"]
    shm_size = 0
  [runners.machine]
    IdleCount = 2
    IdleTime = 3600
    MaxBuilds = 20
    MachineName = "auto-scale-%s"

What am I doing wrong?

It’s my inattention. It turns out that Shared Runners was disabled in the group settings of this project. When I enabled them, then I was able to enable Shared Runners in the settings of the specific project.

1 Like