What does `only: -master` in gitlab-ci.yml match?

Viewed 2058

We have a .gitlab-ci.yml file containing lines like

a_task:
  only:
    - /^production\/mybranch.*$/

which are clearly meant to match the target git ref.

But we also have:

another_task:
  only:
    - master

My question is: does this "master" match a part of the git ref as well (so that a tag my-master-123 would match, too) or is it a symbolic thing?

The reason why am asking is that there is also:

third_task:
  only:
    - tags

That would have to be symbolic, right?

Which would mean that the syntax does e.g. not support a branch named tags, right?

Update

Looks like there are special keywords, tags being one of them.

So indeed that would mean that refs with those special names (external, pipelines, tags, triggers, ...) would not be supported.

1 Answers

from the docs:

only and except are two keywords that set a job policy to limit when jobs are >created:

  1. only defines the names of branches and tags the job runs for.
  2. except defines the names of branches and tags the job does not run for.

Matching via regular expressions is supported, as in your first case, but not default. only: master tasks will run for all refs named master.

Related