Backend: CI merge request pipelines don't start if remote branch matches a protected branch pattern
Summary
When a merge request is created with a remote branch name that matches a pattern in the protected branches list, it does not start the pipelines and instead presents a perpetual rotating circle and Checking pipeline status. message.
Steps to reproduce
- Create a project and populate it with some content (or reuse an existing project).
- Set up a protected
mainbranch for the project with only maintainers allowed to push but developers and maintainers allowed to merge. - Set a protected wildcard branch for the project (it may work for exact match entries, but I didn't test that. We used
rhel-*as our wildcard) - Set
Allowed to mergeandAllowed to pushboth toNo one. Set the force push and codeowner buttons to disabled. - Create a fork of the project in another namespace.
- Commit a minor change and push it to a branch that matches the protected branch's wildcard (We used
rhel-9-main) - Create a merge request from the fork's
rhel-9-mainbranch to the original project's
Example Project
Actual example: redhat/centos-stream/rpms/grub2!46 (closed)
Same patch was able to start the pipeline when submitted from a branch called randomname: redhat/centos-stream/rpms/grub2!50 (closed)
What is the current bug behavior?
The pipeline doesn't start when the merge request is created. Attempting to manually run it from the Pipelines tab results in an unhelpful error message: An error occurred while trying to run a new pipeline for this merge request. The "Learn more" button does not provide any information related to the specific failure.
What is the expected correct behavior?
The pipelines should start and run.
Relevant logs and/or screenshots
See real-world example project above.
Output of checks
This bug happens on GitLab.com