Merge pre-receive hook failure using CODEOWNERS - No one can merge
skip_web_ui_code_owner_validations
feature flag has been enabled
This issue has been resolved but requires that the To follow along for more updates, please see this epic where we intend to remove the feature flag so that it will no longer be required to use.
Update 2021-01-19: The skip_web_ui_code_owner_validations
feature flag was removed from the code in GitLab %13.3. The original problem that requires this feature flag has been resolved.
Summary
It appears that due to a recent change, merge requests that require approval from CODEOWNERS cannot be merged even after receiving approval from a code owner in the CODEOWNERS file.
Pushes to protected branches that contain changes to files that
match patterns defined in `CODEOWNERS` are disabled for
this project. Please submit these changes via a merge request.
The following pattern(s) from CODEOWNERS` were matched:
...
Steps to reproduce
This can be recreated by having a project with a CODEOWNERS file that requires approval by the code owners, and having a separate user (not listed in the CODEOWNERS file) push the merge button.
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)
See slack thread and Zendesk
What is the current bug behavior?
(What actually happens)
What is the expected correct behavior?
(What you should see instead)
User should be able to merge without requiring the merge user to be in the CODEOWNERS file.
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: 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
(If you can, link to the line of code that might be responsible for the problem)
Workaround
- Open rails console:
sudo gitlab-rails console
- Input the following command to enable the
skip_web_ui_code_owner_validations
feature:
Feature.enable(:skip_web_ui_code_owner_validations)
- Make sure the
skip_web_ui_code_owner_validations
was enabled (the output of the command should readTrue
):
Feature.enabled?(:skip_web_ui_code_owner_validations)
See below screenshot: