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
git v2 client: keep the primary clone up to date #30520
Conversation
Move the low-level git logic in ensureCommits() into a new FetchCommits() method in the git interactor, because that's where low-level git interactions belong.
The primary clone can get "stale" if it doesn't keep up with the changes going into the upstream remote. Staleness can result in a performance penalty for EnsureFreshSecondary(), because it would need to fetch more objects to get to the commit SHAs specified in repoOpts.FetchCommits. Git clients that are not using `repoOpts.FetchCommits` cannot get stale, because they invoke the (expensive) RemoteUpdate() call on the primary clone which fetches all refs. However, the primary clones for inrepoconfigs can indeed get stale because it uses `repoOpts.FetchCommits` to do targeted fetches only for the secondary clone since bdd601c (git v2 client for inrepoconfig: allow targeted fetches (2nd attempt), 2023-08-22). Allow updating the primary clone with a new PrimaryCloneUpdateCommits field to periodically update the primary clone with new commits. For inrepoconfigs, we only specify the baseSHA because it may be that the headSHAs never get merged into the base (perhaps the PR gets rejected or abandoned).
@listx: GitHub didn't allow me to request PR reviews from the following users: airbornepony. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@listx: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: listx, michelle192837 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 |
The primary clone can get "stale" if it doesn't keep up with the changes
going into the upstream remote. Staleness can result in a performance
penalty for EnsureFreshSecondary(), because it would need to fetch more
objects to get to the commit SHAs specified in repoOpts.FetchCommits.
Git clients that are not using
repoOpts.FetchCommits
cannot getstale, because they invoke the (expensive) RemoteUpdate() call on the
primary clone which fetches all refs. However, the primary clones for
inrepoconfigs can indeed get stale because it uses
repoOpts.FetchCommits
to do targeted fetches only for the secondaryclone since bdd601c (git v2 client for inrepoconfig: allow targeted
fetches (2nd attempt), 2023-08-22).
Allow updating the primary clone with a new PrimaryCloneUpdateCommits
field to periodically update the primary clone with new commits. For
inrepoconfigs, we only specify the baseSHA because it may be that the
headSHAs never get merged into the base (perhaps the PR gets rejected or
abandoned).
The first commit in this PR refactors ensureCommits() so that it can be
reused as FetchCommits() in the interactor.
/cc @cjwagner @timwangmusic @airbornepony