A common pipeline across multiple projects

Run a common pipeline across all projects for a group

I’m not sure if this is possible, or if it is, how to set it up

  • I have an organization, Foo, with many sub-groups containing projects.
  • I want to add a common setup in all pipelines.
  • I can do this by editing each .gitlab-ci.yml file
  • But this involves many updates to setup. If we want to change a line, each pipeline in each project must be edited. This seems fragile.

Is there a way to tell each pipeline in the many projects ‘insert steps X, Y, and Z in your pipeline’ ?

Details;
I have this to insert in many pipelines (example)

image: ubuntu

stages:
  - customvalidate

customvalidate:
  stage: customvalidate
  script:
     - samplescript.sh

What I’d like to do is tell each of the many pipelines

Use that ci code when you execute your CI process

Hi @briankdunbar

The way I would do this, is to have a single repository in your group which contains CI templates, and then use the includes keyword to use them in “client” projects.

In the case above, you would create a repo called myorg/ci-configs and in that repo you would have a file called (say) customvalidate-template.yml containing:

customvalidate:
  stage: customvalidate
  script:
     - samplescript.sh

Then in your myorg/myproject repo, you would have a .gitlab-ci.yml file like this:

image: ubuntu

stages:
  - customvalidate

include:
  - 'https://gitlab.com/myorg/ci-configs/raw/master/customvalidate.yml'

Your client repositories can also override the templates.

This way, you are essentially creating your own version of GitLab Auto DevOps templates.

Good luck!

Sarah

1 Like

Thank you very much, Sarah.