Pull mirror fails when Allowed to push to protected branch is no one
Summary
A pull mirror will fail to update when the branch protections are Allowed to push
= No one
. No output in UI to indicate failure. Logs show Mirror update for root/test-mirror-from-github successfully finished.
and a 401 You are not allowed to push code to protected branches on this project.
Steps to reproduce
- Set up a pull mirror
- Set
Allow to push
toNo one
on themaster
branch - Push to the remote repository
- Note that the mirror is not updated
- Navigate to the project settings -> repository -> Mirror a repository and click the retry button
- No errors are thrown in the UI and the mirror does not update
What is the current bug behavior?
Mirror will not update when No one
is Allowed to push
. No errors are thrown in the UI. See logs section below for contradicting log output.
What is the expected correct behavior?
UI should show You are not allowed to push code to protected branches on this project.
error message and logs should not report Mirror update for root/test-mirror-from-github successfully finished.
.
Relevant logs and/or screenshots
==> /var/log/gitlab/gitlab-rails/production.log <==
Started POST "/api/v4/internal/allowed" for 127.0.0.1 at 2019-08-30 18:21:43 +0000
Started GET "/root/test-mirror-from-github/-/deploy_keys" for 68.116.230.57 at 2019-08-30 18:21:43 +0000
Processing by Projects::DeployKeysController#index as JSON
Parameters: {"namespace_id"=>"root", "project_id"=>"test-mirror-from-github"}
Completed 200 OK in 130ms (Views: 1.1ms | ActiveRecord: 26.3ms | Elasticsearch: 0.0ms)
Mirror update for root/test-mirror-from-github successfully finished. Update duration: 1}.
==> /var/log/gitlab/gitlab-shell/gitlab-shell.log <==
{"method":"POST","url":"http://127.0.0.1:8080/api/v4/internal/allowed","duration":0.152221104,"gitaly_embedded":true,"pid":2869,"level":"info","msg":"finished HTTP request","time":"2019-08-30T18:21:43+00:00"}
{"method":"POST","url":"http://127.0.0.1:8080/api/v4/internal/allowed","code":"401","body":"{\"status\":false,\"message\":\"You are not allowed to push code to protected branches on this project.\"}","pid":2869,"level":"error","msg":"Call failed","time":"2019-08-30T18:21:43+00:00"}
Customer ticket: https://gitlab.zendesk.com/agent/tickets/130072 (internal use)
Observed on 12.1.6 and I was able to reproduce on 12.2.1.