Easily declare keys and values to be used by several jobs at once, but not all

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Problem to solve

Writing .gitlab-ci.yml for complex pipelines can be very tedious and error-prone, especially as we consider DAG (https://gitlab.com/gitlab-org/gitlab-ce/issues/47063) and complex only and except conditions.

Further details

One way to let people simply their configuration is to be able to share certain keys and values amongst multiple jobs. e.g. if 100 rspec jobs all need to only run if something is changed in the Ruby codebase. Now, YAML anchors and templates can help here, but that can be cumbersome too. We already let people specify some keys/values at the top level of the .gitlab-ci.yml so they are shared with all jobs, but what if you only want a subset of jobs to share values, and if a different subset needs to share different values? Like 20 jobs about iOS, another 20 jobs about Android, and 5 jobs about docs. Manually managing that matrix of configuration is painful. An alternative that might be easier for people to use is to be able specify a hierarchy of jobs, where common values could be attached to a parent, and then any child jobs inherit that configuration. This might make for more readable configuration. Another factor is the use of include. Teams might want to put similar jobs into a file that is included in a master configuration. But within each sub-file, it would be natural to declare common keys. But given how we've implemented include, those common keys wouldn't just apply to jobs in that single file. Perhaps we could make them file-local. But if they were in a hierarchy, we could achieve the same result in a more flexible way.

Proposal

What does success look like, and how can we measure that?

(If no way to measure success, link to an issue that will implement a way to measure this)

Links / references

Edited Aug 19, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading