Search code examples
gitlab-cigitlab-ci-runner

How can I configure GitLab-CI to use shared runners when my main runner is not available?


Is it possible in gitlab-ci to run a job on different runners depending on the availability/busy of the runner? That is, I have a main runner that should do the main work, but in case it is busy or not available, I want shared runners to be used

I tried something like this, but the job was not executed as it was looking for a complete tag match

stages:
  - build
build-job:
  stage: build
  tags:
    - first-runner
    - shared-runner
  script:
    - sleep 150

Solution

  • There is no way currently for you to specify that first use main runner and if its not there use the other runners. There are some open issues related to this in gitlab

    runner priority

    Boolean OR in runner tags

    for now I think only thing you can do is add a common tag for all the runners you want and give that tag in the script.