Skip to content

Support CI job definition outside repository (external `.gitlab-ci.yml`)

Zendesk: https://gitlab.zendesk.com/agent/tickets/19465

Customer wants a way to configure CI jobs other than the .gitlab-ci.yml in the repo. There are some cases, such as when you're working in GitLab and contributing to a project that is external to GitLab it can cause problems because the .gitlab-ci.yml should not go forward to the upstream.

From customer:

I did a quick search in the gitlab code-base and was wondering if some simple approach could be applied. The source seems to search for "ci_yaml_file" from "project.repository.blob_at(...)", perhaps this could be extended with something like "project.default_yaml_file".

Or some other feature that picks up the ".gitlab-ci.yml" from a different location than the repos?

For our purposes, what would suit us really well would be:

  • Search for "default", "out-of-repos" yaml-file.
  • Search and override "default" with "branch-specific" "out-of-repos" yaml-file.
  • Lastly override "out-of-repos" yaml-files if a yaml-file exists in repos root.

The above would be ideal and it seems like it would not conflict the current "in-repos" approach. On a side-note, it would also allow running CI on old changes, which did not have an in-repos .yml, by manually triggering a build.

cc/ @ayufan @grzesiek What do you think?