'Set to auto-merge' and 'Merge immediately' buttons temporarily appear before required MR approvals given
Summary
This bug is similar to Required Approvals for MR Approval Rules not blocking MR merge, but it seemed to merit a separate report.
The user had the All eligible users
merge request approval requirement set to 2, and no approvals had been provided. For a period of time, the MR showed as Ready to merge!
with the Set to auto-merge mad Merge immediately buttons available:
By the time GitLab Support checked this MR two hours after the customer reported this behavior, the MR correctly showed as Merge blocked
with All required approvals must be given
as one of the reasons.
On one such MR, they selected Merge immediately and the merge failed. They have only tested this once.
I wondered if this could be related to <strong data-sourcepos="15:41-15:123">Fix the race condition present when syncing code owners rules to approval rules</strong>, but the screenshot showing this bug was taken 39 minutes after the MR was created. No other commits, besides the initial commit associated with the MR, had been made at this time.
Steps to reproduce
I was unable to reproduce this, but can confirm the following about their configuration:
Settings
- Under Repository > Protected branches, the target branch had this configuration:
- Under Merge requests:
Code owners
Code Owner groups are configured for all changes in the repository. With required approvals set to 2, this meant that one code owner from each group needed to provide approval.
Environment
This happened on a gitlab.com group on February 6, 2024. Presumably, the version was 16.9.x at the time.
Example Project
https://gitlab.com/jgaughan_premium_group/zd-499196-merge-immediately
What is the current bug behavior?
MR temporarily shows as able to merge, despite required approvals not being fulfilled. When they tried to merge during one of these windows, the merge failed.
What is the expected correct behavior?
Never shows as Ready to merge!
until all required approvals are given.
Relevant logs and/or screenshots
Output of checks
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)