How to run a CI script on a runner with any of given tags?

I have a list of specific runners with the unique tag each.

I want to be able to run a reusable CI script on any of these runners.

For example:

job:
    stage: job
    script:
        - script.sh
    tags:
        - runner_one
        - runner_two

I want to run this script on runner_one and runner_two. But this configuration is set to use both of these tags, not only one of them. How to achieve multiple choice of runners tags?

Hi! The simpliest way to achieve what you’re looking for is duplicate the job like this:
job_runner_one:
stage: job
script:
- script.sh
tags:
- runner_one
allow_failure: true
job_runner_two:
stage: job
script:
- script.sh
tags:
- runner_two

Adding the “allow_failure: true”, guarantees the second job to execute, despite exit status from the previus job.

Hope this helps!

BR.-

1 Like

Great, thanks! It works. Only overall pipeline is labeled as stuck and in progress. I set a timeout, but it doesn’t make any change.

Finally, I used a variable for a runner.

So my config looks like this:

variables:
    TAG_RUNNER: runner_one

include:
  - project: 'gitlab_configs'
    file: '/reusable_script.yml'


stages:
    - job

reusable_script.yml:

job:
    stage: job
    script:
        - script.sh
    tags:
      - $TAG_RUNNER
1 Like