Draft: Add CI variable CI_COMMIT_SAME_AS_DEFAULT_BRANCH
What does this MR do and why?
This MR adds a new CI variable CI_COMMIT_SAME_AS_DEFAULT_BRANCH
, which is used for determining if the pipeline sha
is the same as the main branch sha
. It returns either true
as a string or nothing.
It'll be mainly used for new branches with no new commits.
Related to #15170 (closed)
Screenshots or screen recordings
Example config:
echo:
script:
- echo $CI_COMMIT_SAME_AS_DEFAULT_BRANCH
test1:
script: exit 0
rules:
- if: $CI_COMMIT_SAME_AS_DEFAULT_BRANCH
test2:
script: exit 0
rules:
- if: '$CI_COMMIT_SAME_AS_DEFAULT_BRANCH'
test3:
script: exit 0
rules:
- if: '$CI_COMMIT_SAME_AS_DEFAULT_BRANCH == "true"'
test4:
script: exit 0
rules:
- if: '$CI_COMMIT_SAME_AS_DEFAULT_BRANCH != "true"'
When you run on the main branch:
When you run on another branch with a new commit:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Furkan Ayhan