Pull Mirror silently failing when `repository_read_only` is set to true
Summary
Pull mirrors are silently failing if the repository_read_only
attribute is set to true for that repository. No error messages are raised in the UI and even shows that is has updated successfully. The GitLab logs (application_json.log and production_json.log) suggest the same.
# example
./gitlab-rails/application_json.log:{"severity":"INFO","time":"2022-08-18T01:05:35.697Z","correlation_id":"7044caa3a1a76b14f76178f0565ff261","message":"Mirror job scheduled for TESTGROUP/TESTPROJECT with job ID 2f11355759a2202ad2ae5586."}
./gitlab-rails/application_json.log:{"severity":"INFO","time":"2022-08-18T01:05:35.722Z","correlation_id":"7044caa3a1a76b14f76178f0565ff261","message":"Mirror update for TESTGROUP/TESTPROJECT started. Waiting duration: 0"}
./gitlab-rails/application_json.log:{"severity":"INFO","time":"2022-08-18T01:05:35.793Z","correlation_id":"7044caa3a1a76b14f76178f0565ff261","message":"Mirror update for TESTGROUP/TESTPROJECT successfully finished. Update duration: 0}."}
Steps to reproduce
- Create a Pull Repository Mirror.
- Observe that the mirror is updated properly.
- Open the Rails Console and set the project/mirror to read only state.
p=Project.find_by_full_path('TESTGROUP/TESTPROJECT')
p.update!(repository_read_only: true)
- Make changes in the upstream repository.
- Force an update in your GitLab mirror by going to
Settings > Repository > Mirroring repositories
and selecting theUpdate Now
button. - Observe that the mirror is supposedly updated however if you check the files, the changes are not picked up.
Example Project
What is the current bug behavior?
The mirror appears to be successful in pulling any updates despite not actually picking up the updates.
What is the expected correct behavior?
The mirror repository should fail mirroring and raise a message in the UI.
Relevant logs and/or screenshots
Output of checks
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)