-
Notifications
You must be signed in to change notification settings - Fork 449
Cleanup worktree defensively #414
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
Conversation
nan-yu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor comment. Otherwise, LGTM
janetkuo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thockin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
As discussed on chat - a small e2e for this would help a lot. This doesn't directly port to v4, and I don't mind adapting it myself, but that test would help :)
c243c4a to
42903a2
Compare
I tried doing this for the e2e but it passes even without my change. I did Next it tried So i could not write and effective test case. Iam suspecting the container is cleaning up the worktree as part of startup ? |
|
Can you |
|
Without fix, the test case fails: With fix, the testcase passes: |
thockin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test case. Can you try to minimize the sleeps?
I agree with @nan-yu comment (https://github.com/kubernetes/git-sync/pull/414/files#r655741357) - just a short change to the comment there.
Other than that, LGTM
nan-yu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Reduced sleep. Addressed @nan-yu 's comment. |
This is to avoid wedge cases where the worktree was created but this function error'd without cleaning the worktree. Next timearound, the sync loop fails to create the worktree and bails out. We observed a case where due to kubernetes#412, the next sync loop failed with this error: " Run(git worktree add /repo/root/rev-nnnn origin/develop): exit status 128: { stdout: \"Preparing worktree (detached HEAD nnnn)\\n\", stderr: \"fatal: '/repo/root/rev-nnnn' already exists\\n\" }"
thockin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: barney-s, janetkuo, nan-yu, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is to avoid wedge cases where the worktree was created but this function error'd without cleaning the worktree.
Next timearound, the sync loop fails to create the worktree and bails out.
We observed a case where due to #412, the next sync loop failed with this error:
" Run(git worktree add /repo/root/rev-nnnn origin/develop): exit status 128: { stdout: "Preparing worktree (detached HEAD nnnn)\n", stderr: "fatal: '/repo/root/rev-nnnn' already exists\n" }"
Fixes #411