Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LFS mirroring support for legacy batch _links responses #31512

Closed
rremer opened this issue Jun 27, 2024 · 0 comments · Fixed by #31513
Closed

LFS mirroring support for legacy batch _links responses #31512

rremer opened this issue Jun 27, 2024 · 0 comments · Fixed by #31513
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@rremer
Copy link
Contributor

rremer commented Jun 27, 2024

Feature Description

There are LFS server implementations in the wild which have batch API responses in an older/deprecated schema. Recent versions of Jfrog Artifactory, as well as Microsoft TFS cannot have their LFS objects mirrored into Gitea because they serve a batch API and the 'download' action in responses is not honored because it's under the field _links instead of actions.

The most recent version of git-lfs still supports this 'deprecated' field: https://github.com/git-lfs/git-lfs/blob/main/tq/transfer.go#L56 , so a git lfs pull would work from one of the servers above using the native client, but not with Gitea.

I believe Gitea should support both fields to keep parity with native git-lfs clients until such time as they deprecate it (forcing servers like Artifactory to update their responses).

Screenshots

No response

@rremer rremer added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Jun 27, 2024
@lunny lunny added this to the 1.23.0 milestone Jun 28, 2024
@lunny lunny closed this as completed in df805d6 Jun 28, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 27, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
Support legacy _links LFS batch response.

Fixes go-gitea#31512.

This is backwards-compatible change to the LFS client so that, upon
mirroring from an upstream which has a batch api, it can download
objects whether the responses contain the `_links` field or its
successor the `actions` field. When Gitea must fallback to the legacy
`_links` field a logline is emitted at INFO level which looks like this:
```
...s/lfs/http_client.go:188:performOperation() [I] <LFSPointer ee95d0a27ccdfc7c12516d4f80dcf144a5eaf10d0461d282a7206390635cdbee:160> is using a deprecated batch schema response!
```

I've only run `test-backend` with this code, but added a new test to
cover this case. Additionally I have a fork with this change deployed
which I've confirmed syncs LFS from Gitea<-Artifactory (which has legacy
`_links`) as well as from Gitea<-Gitea (which has the modern `actions`).

Signed-off-by: Royce Remer <royceremer@gmail.com>
(cherry picked from commit df805d6)
(cherry picked from commit 45181ee)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants