Geo: Forwarded Git fetch requests should not contain the word "push"
Summary
When a Geo secondary receives a Git fetch request, and it redirects it to the Geo primary, it should use a URL that is agnostic of the "push"/"pull" action.
$ git clone http://gdk.test:3001/snippets/21.git
Cloning into '21'...
warning: redirecting to http://gdk.test:3000/-/push_from_secondary/2/snippets/21.git/
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done.
See: warning: redirecting to http://gdk.test:3000/-/push_from_secondary/2/snippets/21.git/
push_from_secondary
may be confusing to developers since they only "cloned".
Steps to reproduce
The example in the description will not be reproducible after #292688 (closed) is fixed. So here is another way:
- SSH into Geo secondary
gitlab-ctl stop geo-logcursor
gitlab-ctl stop sidekiq
- Create a project with a repo on the Geo primary
- Copy the Git clone URL from the primary
- Wait long enough to ensure the Postgres DB is replicated (should be instant with test instances)
git clone <Git clone URL but edit it to request the secondary>
Since the project repo is not yet replicated, the request to the secondary will be redirected to the primary. Git will tell you you are being redirected to the push_from_secondary
URL.
Example Project
What is the current bug behavior?
What is the expected correct behavior?
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)
Possible fixes
- Rename the route from
push_from_secondary
to e.g.redirected_from_secondary
We may want to do it like:
- Add and use route
redirected_from_secondary
- Next minor release, remove
push_from_secondary
route