Global only/except to make MR Pipelines user-friendly to use
Problem to Solve
With the https://gitlab.com/gitlab-org/gitlab-ce/issues/15310 we introduced a support for merge-requests pipelines. However, this implementation is not user-friendly as you have to manually specify for each job the valid only:
syntax.
You can see a specific example of how difficult it can be to use only/except given some of the current behavior at gitlab-com/www-gitlab-com!17638 (merged); if we solve this correctly, solving that should be easier/possible.
Current defaults
Today's default only syntax:
rspec:
only:
- branches
- tags
Enable MR pipelines:
In order to enable MR pipelines you should change it to look like:
rspec:
only:
- master
- merge-requests
- tags
only:
Global I think that we want to introduce a change that would allow to change the defaults of that specification as wide as possible, ideally on global context of job, and making it non-master specific:
only:
- HEAD
- merge-requests
- tags
rspec: ...
We should also implement the HEAD
.
Aliasing problem
The problem here is that only:
can be a valid job name, so to make it possible we need to perform a filtering of potential jobs vs global configuration entries. I think that we could consider things to be potential jobs if they are hash containing script:
entry. So technically be able to detect:
only:
script: ...
only:
- HEAD
- merge-requests
- tags
This is likely useful, as we want to introduce more global entries, but keeping it backward compatible. Today's global configuration entries do overwrite jobs under that name.