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

fix(versions): Delete and reclone version stream significantly less. #5981

Conversation

abayer
Copy link
Contributor

@abayer abayer commented Oct 30, 2019

Submitter checklist

  • Change is code complete and matches issue description.
  • Change is covered by existing or new tests.

Description

By switching to an approach using our Gitter APIs rather than the go-git for handling an existing clone, we should drastically decrease the number of delete and reclones.

I verified that with this, I can get rid of the sleep I had to insert in #5977 to get the new test there to pass, and the test still passes.

Special notes for the reviewer(s)

/assign @pmuir

Which issue this PR fixes

fixes #5976

@@ -869,6 +869,11 @@ func (g *GitCLI) FetchTags(dir string) error {
return g.gitCmd(dir, "fetch", "--tags")
}

// FetchRemoteTags fetches all the tags from a remote repository
func (g *GitCLI) FetchRemoteTags(dir string, repo string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to extend the command above, and check if repo is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think I'm gonna do a dive through git_cli at some point soon and clean up a bunch of stuff.

if err != nil {
dir, err := deleteAndReClone(wrkDir, versionRepository, versionRef, gitter)
if err != nil {
return "", "", errors.WithStack(err)
}
return dir, versionRef, nil
}
// TODO: It might be good to do the same behavior for any branch - just the checkout approach works for
// tags and commit-ishs, but not branches. I'm not sure how we can tell if it's a branch vs a tag, though.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way I know how to do this is to use the FilterTags method to check if the tag exists or not

@pmuir
Copy link
Contributor

pmuir commented Oct 30, 2019

/lgtm

By switching to an approach using our `Gitter` APIs rather than the
`go-git` for handling an existing clone, we should drastically
decrease the number of delete and reclones.

fixes jenkins-x#5976

Signed-off-by: Andrew Bayer <[email protected]>
@abayer abayer force-pushed the get-rid-of-branch-specific-fetch-logic-in-versionstream-gitrepo branch from 5b47fa9 to 2a57332 Compare October 30, 2019 13:14
@pmuir
Copy link
Contributor

pmuir commented Oct 30, 2019

/lgtm

@jenkins-x-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pmuir

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@abayer
Copy link
Contributor Author

abayer commented Oct 30, 2019

/test all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version stream resolver always deletes and reclones for any version ref but a branch
3 participants