DEV Community

rndmh3ro
rndmh3ro

Posted on • Originally published at zufallsheld.de on

TIL how to alter gitlab-ci include-directives

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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!

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more