CI_MERGE_REQUEST_DIFF_BASE_SHA is not set when MR doesn't contain any commits
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
If MR doesn't contain any commits and CI runs, CI_MERGE_REQUEST_DIFF_BASE_SHA
is not set, despite the documentation saying:
These variables are available when:
- The pipelines are merge request pipelines.
- The merge request is open.
| CI_MERGE_REQUEST_DIFF_BASE_SHA | 13.7 | all | The base SHA of the merge request diff. |
Steps to reproduce
- Create a CI pipeline that uses or displays CI_MERGE_REQUEST_DIFF_BASE_SHA
- Create an empty MR that runs CI (this is disabled by default, so bug #219583 (closed) can be used
- Check CI job to see how CI_MERGE_REQUEST_DIFF_BASE_SHA is used or displayed
Example Project
What is the current bug behavior?
CI_MERGE_REQUEST_DIFF_BASE_SHA is not set
What is the expected correct behavior?
CI_MERGE_REQUEST_DIFF_BASE_SHA is set to the base commit for this MR
Relevant logs and/or screenshots
https://gitlab.com/Woodz1/gitlab-bug-repros/-/jobs/3067742250
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)