We have a set of common pipeline jobs that are shared among different projects in Gitlab. We include them like this:

include:
  - project: 'shared/gitlab/linting'
    ref: master
    file:
      - markdown.yml
      - ansible.yml

When you do this, these included jobs get executed with the runner that is defined in the included job. We do want to use a specific project runner though. We normally achieve this by adding a tag to the jobs. But how do you add a tag to a job that you include? The Gitlab community forums provided the answer. You simply add a tag to the job. :)

ansible:
  tags:
    - docker

This way the job “ansible” that is defined in the included gitlab-ci configuration gets the “docker” tag added.

You can of course not only add tags but other things there, too!



Related posts: