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)
Proposal
Rename the route from push_from_secondary
to e.g. from_secondary
Implementation Guide:
- Search the
config/
directory for thepush_from_secondary
routes - Duplicate the routes but use the name
from_secondary
- Find and replace, in the whole
gitlab
codebase,push_from_secondary
withfrom_secondary
The next step, which must not land in the same release, is #516281 (closed).