Skip to content

Git lfs e2e - #1012

Open
rdartus wants to merge 6 commits into
kubernetes:masterfrom
rdartus:git-lfs-e2e
Open

rdartus wants to merge 6 commits into
kubernetes:masterfrom
rdartus:git-lfs-e2e

Conversation

@rdartus

@rdartus rdartus commented Nov 7, 2026 •

Copy link
Copy Markdown

/kind feature

What does this PR do?

Implement git lfs so that git sync is compatible with repo using git-lfs (in v4):

  1. Added a flag --git-lfs (env : GITSYNC_GIT_LFS), false by default.
  2. Added test server in _test_tools/lfs-server/
  3. Added dependency in dockerfile.in : -p git-lfs so that lfs is usable
  4. Adjust man / readme - to add the flag --git-lfs

Why

This feature was requested as far as in git-sync v3 and never really finished du to the contributor lack of time. (#174 / #654 / #699)

Limits

Known limits (and what I couldn't decide alone) :

  1. the host launching e2e tests should have git-lfs installed
  2. Old LFS files are not deleted, they accumulate in $ROOT/.git/lfs - it should be pruned (git lfs prune) so that it doesn't accumulate...

Testing

go vet, gofmt : OK.
Tests were done with test_git.sh, with the lfs server added in test_e2e.sh
Also tested with github action (build, test, publish)
image

Finally with this image I checked with my personal cluster if this image worked (logs attached) - with my use case
logs.txt

Notes for reviewers

I wrote theses changes and commit with AI (ashamed to say that it did a better job than my last try to add lfs 2 years ago...)
I garantee that, what I wrote in this comment is 100% human and you will converse with a human.

rdartus and others added 6 commits November 3, 2026 21:52
With --git-lfs, enable the git-lfs filters in git-sync's private gitconfig
(git lfs install --skip-repo), so LFS-tracked files are downloaded when git
checks them out (including in submodules) instead of being left as pointers.
git-sync fails at startup if git-lfs is not installed, and a sync fails if an
LFS object can't be fetched.

Note: just running 'git lfs pull' is not enough, since it skips replacing
pointer files unless the filters are already configured.
- Dockerfile.in: install git-lfs.
- _test_tools/lfs-server: lfs-test-server (public mode) in a scratch image.  The
  binary is built by make test-tools from the version pinned in tools/go.mod,
  not downloaded at image-build time.
- test_e2e.sh: tests for LFS disabled, enabled, --depth, updates and a missing
  object.  No git server is needed: objects are uploaded with git lfs push.
git_lfs_updates failed on slower runners: the test committed first and
uploaded the LFS object afterwards, so a git-sync polling every 100ms could
fetch the new commit before the object existed on the server, and the checkout
failed with a 404 (and git-sync exits on the first failure).

Stage the file, push its object by ID, and only then commit.
The flag was only described in the README, and its text still described a
'git lfs pull' approach.  Add it to the manual that --man prints (the manual
in main.go and the README carry the same text), place it with the other --git-*
flags, and describe the actual behavior.
@kubernetes-prow kubernetes-prow Bot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 7, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @rdartus!

It looks like this is your first PR to kubernetes/git-sync 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/git-sync has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow
kubernetes-prow Bot requested a review from sdowell November 7, 2026 22:25
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rdartus
Once this PR has been reviewed and has the lgtm label, please assign janetkuo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested a review from thockin November 7, 2026 22:25
@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant