Skip to content

GitLab CI tag exclusion

Description

In certain instances, I want to be able to run a job on an instance which does not have a certain tag. For example, I have tagged a specific runner that I have to denote that it has the configuration to connect a private repository (let's say repository).

Simply creating another specific runner which has another tag saying that it does not have the repository (e.g. not-repository) would be possible but would exclude the ability for the job to run on a shared runner for which tags can't be added to.

Proposal

Allow the use of !repository in the tags: configuration of the .gitlab-ci.yml to denote that the build can run on runners without the tag repository.

Alternatively, create a new section called exclude-tags: or tags-exclude:. Or support a syntax like:

tags:
  include:
    - included-tag
    ...
  exclude:
    - repository

Falling back to the old behaviour when the value of tags: is a list rather than a map.

Links / references