Skip to content

Geo: Fetching a personal snippet repo from a secondary always redirects the request to the primary

Summary

Fetching a personal snippet over HTTP from a Geo secondary always redirects the request to the Geo primary.

The fetch succeeds, but it should fetch directly from the secondary. Also the terminal output is off-putting (because the URL contains push_from_secondary so an attentive dev might reasonably wonder how they managed to push something during clone). => I opened a separate bug for this since it isn't snippet-specific #292690 (closed)

$ 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.

I assume SSH fetch/clone also has this bug.

Steps to reproduce

  1. Clone a personal snippet

Example Project

What is the current bug behavior?

Fetch output includes e.g.:

warning: redirecting to http://gdk.test:3000/-/push_from_secondary/2/snippets/21.git/

(And the request is actually redirected)

What is the expected correct behavior?

Fetch output should not include e.g.:

warning: redirecting to http://gdk.test:3000/-/push_from_secondary/2/snippets/21.git/

(And the request should not be redirected)

Relevant logs and/or screenshots

Possible fixes

It looks like this line is returning true, because personal snippets never have a project: https://gitlab.com/gitlab-org/gitlab/-/blob/v13.6.2-ee/ee/app/controllers/ee/repositories/git_http_client_controller.rb#L72. It should return false or not be checked, for personal snippets.

Edited by Michael Kozono