Merge request pipeline does not accept CI variables from git push option
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
The merge request pipelines do not accept push options for CI/CD variables. This also makes the variable conditions in rules unusable.
Note: It is known that passing variables and CI.SKIP only work for Branch pipelines today. This request is to extend the behavior to merge request pipelines as well.
Steps to reproduce
-
Create a pipeline using the following configuration:
# .gitlab-ci.yml always_job: rules: - if: '$CI' script: - env | grep -E '^CI_(PIPELINE|JOB)_' | sort - echo "SKIP_MY_EXAMPLE_JOB = $SKIP_MY_EXAMPLE_JOB" my_example: rules: - if: '$SKIP_MY_EXAMPLE_JOB != "true"' script: - echo "SKIP_MY_EXAMPLE_JOB = $SKIP_MY_EXAMPLE_JOB"
-
Create a test branch and add a dummy commit:
git checkout -b test git commit --allow-empty --message='Test trigger pipeline'
-
Push the test branch with a variable in a git push option:
git push origin test --push-option=ci.variable=SKIP_MY_EXAMPLE_JOB=true
-
Create a merge request for this branch
-
Look at the pipeline page and notice the two pipelines where
my_example
job is absent in the branch pipeline, but not absent in the merge request pipeline. Also notice theSKIP_MY_EXAMPLE_JOB
variable is empty in the merge request pipeline.
branch pipeline | merge request pipeline |
---|---|
![]() |
![]() |
![]() |
![]() |
Example Project
https://gitlab.com/maikelv/test-push-option-variables-merge-request-pipeline-bug
What is the current bug behavior?
The CI push option variable SKIP_MY_EXAMPLE_JOB
is not passed to the merge request pipeline:
What is the expected behavior?
The CI push option variable SKIP_MY_EXAMPLE_JOB
also being passed to the merge request pipeline:
This is not an existing log, but a photoshopped screenshot to communicate the desired output
Output of checks
This bug happens on GitLab.com (currently v15.4.0-pre 48afc24c73f)
Potential workarounds
- Some customers have found success using the
CI_COMMIT_MESSAGE
(forum post) and rules to skip CI with Merge Request pipelines but we know this is not a great solution.