feat: add LFS snapshot support to git strategy#191
Draft
joshfriend wants to merge 1 commit intomainfrom
Draft
Conversation
c6c48bf to
d582807
Compare
When lfs-snapshot-enabled is true, cachew generates a separate LFS object
snapshot (lfs-snapshot.tar.zst) alongside the regular git snapshot. This
archives .git/lfs/objects/ after running git lfs fetch, and serves it at
GET /git/{repo}/lfs-snapshot.tar.zst.
Adds snapshot.CreateSubdir for archiving a named subdirectory with its
path prefix preserved in the tar. LFS snapshot jobs are scheduled on both
startup discovery and first clone of new repos.
d582807 to
dc0f91a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
lfs-snapshot-enabled = truein the git strategy block, cachew generates a separate LFS object archive on each snapshot interval, served atGET /git/{host}/{path}/lfs-snapshot.tar.zst.After each git snapshot,
generateAndUploadLFSSnapshotclones the mirror into a temp dir, injects a short-lived GitHub App token, runsgit lfs fetch origin HEAD, then archives the resulting.git/lfs/tree. Paths inside the archive are stored relative to.git/(i.e../lfs/objects/xx/yy/sha256), so a client can extract directly into the repo's.git/directory. The archive is served via the existingserveCachedArtifacthelper with standard 200/304/404 behaviour.A new
snapshot.CreateSubdirhelper in the snapshot package supports archiving a named subdirectory within a parent directory while preserving the subdirectory prefix in tar paths.LFS snapshot jobs run on the same periodic schedule as git snapshots and are registered for both newly cloned repos and repos discovered on startup.