Empty rebases should not generate a pipeline
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
When the merge request rebase REST API is used, every invocation done generates a new pipeline.
A pipeline is generated even if the rebase itself was a no-operation (target had no new changes).
Repeating the /rebase API keeps generating new pipelines, all for the same ref, which wastes resources.
This is incorrect behavior as an empty push from the CLI, as comparison, does not generate a new pipeline.
The API does provide a skip_ci
option to explicitly skip the pipeline via a push option set internally, but the default behavior appears incorrect when the rebase does no real work/change.
Steps to reproduce
- Open an MR on any project with a pipeline
- Run the PUT Rebase API on the MR repeatedly (4-5 times): https://docs.gitlab.com/ee/api/merge_requests.html#rebase-a-merge-request
- Observe the MR's pipelines tab for duplicated, and un-cancelled pipelines
Example Project
https://gitlab.com/gitlab-gold/hchouraria/rebase-redundant-pipeline/-/merge_requests/1/pipelines
What is the current bug behavior?
Rebase with no change generates a pipeline.
What is the expected correct behavior?
Rebase with no change does not generate a pipeline.
(Or,)
New rebase generated pipelines must cancel previously running redundant pipelines, even if they are for the same ref.
Relevant logs and/or screenshots
https://gitlab.com/gitlab-gold/hchouraria/rebase-redundant-pipeline/-/merge_requests/1/pipelines
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)
Possible fixes
The CI run here is unconditional, unless entirely skipped: https://gitlab.com/gitlab-org/gitlab/blob/v13.11.0-ee/app/models/repository.rb#L1050-1068