Applied merge request approval rules changing post-merge
Summary
We have a set of merge request approval rules applied for a project. When opening and working a merge request against the main branch, the rules specific to the main branch are displayed and behave correctly. However after the merge request is merged, the approval rules listed on the MR change and start displaying approval rules that are not applicable and are for different branches. I've attached a few screenshots of a current rule set and an example MR post-merge that's displaying an incorrect rule. This has started causing confusion with our teams as at first glance it seems like merge requests have been merged without proper approvals.
In the pictured approval rules, there is a special rule for target branches matching hotfix*
target branch names. This was (correctly) not applied to the pictured Merge Request while it was in progress, however after it had been merged the hotfix*
rule is now incorrectly applied (pictured).
Small note, this is not specific to the wildcarded approval rules, and is demonstrated even for CODEOWNERS approval rules showing up after the fact when no owned files were modified. This hotfix example just happened to be a particularly clear case.
Steps to reproduce
- Setup a project with a normal protected
main
branch. No other long-lived branches are needed - Setup a protected branch wildcard that matches
hotfix*
- Setup merge request approval rule requiring at least 1 approval for the
main
branch - Setup a second merge request approval rule requiring at least 1 approval for the
hotfix*
wildcard. It's ideal if the approvers for this do not overlap with themain
approver group - Create a merge request against the
main
branch - Capture/Document that only the 1
main
branch approval rule has been applied - Approve and merge the merge request
- Note that post-merge, the approval rules have changed and now list the additional and unfulfilled approval for the
hotfix*
branch approval rule
Example Project
Not able to reproduce on GitLab.com due to merge request approvals being a paid feature.
What is the current bug behavior?
Merge approval rules are incorrectly applied to a merge request after it is merged in.
What is the expected correct behavior?
Merge approval rules are static and unchanged after a merge request is merged in.
Relevant logs and/or screenshots
Configured Approval Rules:
Approval rules post-merge:
Output of checks
Results of GitLab environment info
Self-Hosted - GitLab Enterprise Edition 15.3.1-ee
Results of GitLab application Check
No admin access to perform these checks
Possible fixes
Unknown