Unclear error is shown when trying to update codeowners-enabled files via GitLab UI
Summary
Unclear error is shown when trying to update files via GitLab UI if CODEOWNERS
are configured for this file.
Steps to reproduce
-
Create a new project in GitLab.
-
Go to Project Settings > Repository > Protected Branches and enable
Code owner approval
on the master branch. -
Create
CODEOWNERS
file containingREADME.md @user1 @user2
. -
As a user1 (maintainer of the project) try to modify
README.md
. You will get an error in UI:Pushes to protected branches that contain changes to files that
-
If you check the log
/var/log/gitlab/gitaly/gitlab-shell.log
, you will see the full error message:{"method":"POST","url":"http://127.0.0.1:8080/api/v4/internal/allowed","code":"401","body":" {\"status\":false,\"message\":\"Pushes to protected branches that contain changes to files that\\nmatch patterns defined in `CODEOWNERS` are disabled for\\nthis project. Please submit these changes via a merge request.\\n\\nThe following pattern(s) from `CODEOWNERS` were matched:\\n- README.md\\n\"}","pid":29342,"level":"error","msg":"Call failed","time":"2020-06-11T10:01:12+00:00"}```
What is the current bug behavior?
Full error is not shown, and it can confuse users.
What is the expected correct behavior?
Full and clear error should be shown.
Relevant logs and/or screenshots
The error is shown in the attached screenshot:
Error from the log file is shown above.
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.6p146 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.9 Git Version: 2.26.2 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 13.0.6-ee Revision: 4c8f8b0d9ee Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 11.7 URL: https://gitlabhost.tld HTTP Clone URL: https://gitlabhost.tld/some-group/some-project.git SSH Clone URL: git@gitlabhost.tld:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 13.2.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Further investigation
If the feature flag skip_web_ui_code_owner_validations
is enabled, the error is not shown in UI.