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

Don't clean git repository when not needed #106

Merged
merged 8 commits into from
Oct 29, 2020
Merged

Don't clean git repository when not needed #106

merged 8 commits into from
Oct 29, 2020

Conversation

olblak
Copy link
Member

@olblak olblak commented Oct 24, 2020

Fix #105

This PR improve several things:

  • Add a clean parameter for the diff subcommand like updatecli diff --clean=true
  • By default delete the temporary directory content at the end of a full run instead of per strategy run, so we only clone git repositories once
  • Change --clean parameter to keep or delete the main working directory instead of per repository

This PR drastically drastically improve performances, I tested on jenkins-infra/charts

Before:
updatecli apply --config updateCli/updateCli.d --values updateCli/values.yaml 39,12s user 6,91s system 43% cpu 1:45,92 total
After:
updatecli apply --config updateCli/updateCli.d --values updateCli/values.yaml 30,29s user 3,60s system 66% cpu 51,092 total

@olblak olblak added the enhancement New feature or request label Oct 24, 2020
@jetersen
Copy link
Member

jetersen commented Oct 24, 2020

Hmm the cleaning of the directory is one speed improvement.

I however think another place is to perform clone only once perhaps by determinering each repository that would need a clone and than just use git checkout $branch to reset the working directory before each operation.

https://github.com/olblak/updatecli/blob/4f51ca1e20eca618823f1ff207d67cf6dccd0ba5/pkg/engine/target/main.go#L88

@olblak
Copy link
Member Author

olblak commented Oct 24, 2020

Hmm the cleaning of the directory is one speed improvement.

I however think another place is to perform clone only once perhaps by determinering each repository that would need a clone and than just use git checkout $branch to reset the working directory before each operation.

https://github.com/olblak/updatecli/blob/4f51ca1e20eca618823f1ff207d67cf6dccd0ba5/pkg/engine/target/main.go#L88

That's a good point, thanks for the suggestion. It won't be too hard to do that and it will be useful for later stages.

@olblak
Copy link
Member Author

olblak commented Oct 29, 2020

Cloning the repository once requires some refactoring so I am going to merge this one and then a new one when ready

@olblak olblak merged commit b361bd2 into master Oct 29, 2020
@olblak olblak changed the title Only clone git repository once Don't clean git repository when not needed Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only clone git repository once
2 participants