Update keyword usage in CI job configurations
Problem
In a review for https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/3869, it came up that rules
is preferred to using only
in CI job configurations. This is because only
is not being actively developed as mentioned in our docs about it.
Proposal
Replace all usages of only
in CI job configurations by using rules
. Here's an example:
Current with only
:
only:
- staging
New with rules
:
rules:
- if: $CI_PIPELINE_SOURCE == "staging"
Result
Use the preferred method and avoid using something "deprecated".
Edited by Corinna Gogolok