Is it possible to have one common .gitlab-ci.yml instead of duplicating the changes to .gitlab-ci.yml in every project

gitlab

At the moment we put a .gitlab-ci.yml in every project. At the moment we have more than 50 projects and every time something changes to the .gitlab-ci.yml the team has to change the structure in all of the projects. Is it possible to have one common .gitlab-ci.yml?

Attempts

  1. Tried to have one gitlab-ci.yml, but do not know how to change the default path to this file
  2. common scripts decrease the amount of code duplication, but if the gitlab-ci.yml structure changes we have to implement it in all the projects

Best Answer

No this is not possible. It goes against the idea of why this method exists, because what if you add a git repo/project that needs a completely different yml file?

What you could do (as you mentioned) is have a script you run, which is downloaded during the .gitlab-ci.yml run process. Something like this:

stages:
  - prep
  - run

get_script:
  stage: prep
  script:
    - wget http://my_local_script.lan/run_suite.sh -O /tmp/run_suite.sh

run_script:
  stage: run
  script:
    - bash /tmp/run_suite.sh

Set this as the script for every project, and then all you need to do is update the run_suite.sh once and all new projects will use it.

I don't think there's any better way than that, I'm afraid.

Related Topic