Docs feedback - feature proposal: Allow "only/except" in "default" section of .gitlab-ci.yml files
Problem to solve
Reduce redundant only/except blocks in configs for various jobs in the CI config file.
Intended users
All CI users.
Further details
Travis CI supports this:
---
language: shell
jobs:
include:
- name: hello
script: echo hello
- name: goodbye
script: echo goodbye
branches:
only:
- master
All the jobs ("hello" and "goodbye") will only be run on pull requests/pushes to master.
Proposal
---
default:
image: alpine:latest
only:
- master
hello:
script: echo hello
goodbye:
script: echo goodbye
wellmeetagain:
script: echo we'll meet again
only:
- merge_requests
The only/except sections should behave like other fields in the default. That is, if there's an equivalent section in a job, it should override the default. In the example above, the wellmeetagain job should only run for merge requests, while hello and goodbye run for any push to master.
Permissions and Security
Documentation
Availability & Testing
What does success look like, and how can we measure that?
What is the type of buyer?
Links / references
- Gitlab CI's own
defaultdocs: https://docs.gitlab.com/ee/ci/yaml/#setting-default-parameters - Gitlab CI's own
onlydocs: https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic - Travis CI's
branchesdocs: https://docs.travis-ci.com/user/customizing-the-build/#safelisting-or-blocklisting-branches
Edited by goodspark