Geo: Fix LFS for location-aware Git URL
What does this MR do?
When using Geo and Location-aware Git URL, pushing commits with new LFS files to the location-aware Git URL will fail if the requests are routed to a Geo secondary site.
The request flow is complex, but suffice to say that lfs/objects/batch
upload requests are sent to the Geo primary site, so this MR makes the Geo primary site respond with URLs that point to itself, instead of URLs that point to the location-aware Git URL.
This fixes the bug, since PUT upload requests are no longer sent to the location-aware Git URL. And this improves performance of Git LFS pushes to a location-aware URL, since a number of redirects are avoided.
This is safe because it is already required that a Geo primary site must be accessible to users at its external_url
. And in fact, other parts of the push-to-secondary request flow already depend on this.
Resolves #294483 (closed)
Screenshots (strongly suggested)
Before
➜ test_many_lfs git:(master) git push single-git-url master
remote:
remote: This request to a Geo secondary node will be forwarded to the
remote: Geo primary node:
remote:
remote: ssh://mkozonogitlab@gdk.test:2222/root/test-lfs-with-single-git-url.git
remote:
Locking support detected on remote "single-git-url". Consider enabling it with:
$ git config lfs.https://gdk-single-git.test/root/test-lfs-with-single-git-url.git/info/lfs.locksverify true
LFS: Authorization error: http://gdk-single-git.test:3001/root/test-lfs-with-single-git-url.git/gitlab-lfs/objects/aea0851b97ab2411a1e6fc4895b58a3e8e3d8a308a21c0d85eced574aca1d47b/27
Check that you have proper access to the repository
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done.
error: failed to push some refs to 'ssh://gdk-single-git.test:2223/root/test-lfs-with-single-git-url.git'
After
➜ test_many_lfs git:(master) git push single-git-url master
remote:
remote: This request to a Geo secondary node will be forwarded to the
remote: Geo primary node:
remote:
remote: ssh://mkozonogitlab@gdk.test:2222/root/test-lfs-with-single-git-url.git
remote:
Locking support detected on remote "single-git-url". Consider enabling it with:
$ git config lfs.https://gdk-single-git.test/root/test-lfs-with-single-git-url.git/info/lfs.locksverify true
Uploading LFS objects: 100% (1/1), 27 B | 0 B/s, done.
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.04 KiB | 1.04 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
To ssh://gdk-single-git.test:2223/root/test-lfs-with-single-git-url.git
04ed37a..cf00293 master -> master
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.