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

Support shallow fetch to optimize start up cost for large repos #127

Open
tracemeyers opened this issue Nov 7, 2023 · 3 comments
Open

Comments

@tracemeyers
Copy link
Contributor

I have a lot of OSB provisionings in my git repo and a lot of chatty commits that result in very, very, very long clones every time a new k8s pod of unipipe is created.

It would be great to have an optional env var to configure shallow fetches for such scenarios. Something like this but not hard coded (requires jgit 6.3+).

diff --git a/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt b/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt
index 4d8d4cd..9b8af45 100644
--- a/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt
+++ b/src/main/kotlin/io/meshcloud/dockerosb/persistence/GitHandlerService.kt
@@ -295,6 +295,7 @@ class GitHandlerService(
 
           // fetch remote
           git.fetch()
+              .setDepth(1)
               .apply {
                 refSpecs = listOf(
                     RefSpec("refs/heads/${gitConfig.remoteBranch}:refs/remotes/origin/${gitConfig.remoteBranch}")
@JohannesRudolph
Copy link
Member

This is a very good idea.

However, shallow clones with insufficient depth can lead to issues with some git operations like rebase (for sure, but iirc that's not used in unripe) and merge (not sure). I think we've seen that with https://github.com/meshcloud/gate-resource but can't find the original issue anymore right now.

Have you attempted to run with a minimum depth in production?

@tracemeyers
Copy link
Contributor Author

tracemeyers commented Nov 7, 2023 via email

@JohannesRudolph
Copy link
Member

HI @tracemeyers we've upgrade to jgit 6.10 since. Would you want to pick this optimization up again and provide a PR?

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

No branches or pull requests

2 participants