Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inrepoconfig: optimize secondary clones
The only data we need from a clone inrepoconfig repo is the .prow contents (aside: we clone it in the first place so that we can merge to the base branch). The underlying Git client actually uses 2 clones --- first a mirror clone (git clone --mirror ...), and then a secondary local clone into a temporary folder (git clone ...). This secondary clone is the one we are optimizing here. This adds 2 optimizations: (1) Avoid populating object files with "--shared" flag. This way, the .git folder of the secondary clone can just have a pointer to the mirror clone. This saves a lot of disk space for large repos (not to mention that both the CPU time and disk usage for creating this clone is vastly reduced, especially when combined with the next optimization). (2) Avoid a full checkout with sparse-checkout (supported since Git 2.25). This way, we can avoid deflating Git blob objects into file paths on disk for everything except (a) files at the toplevel and (b) files specified by the "git sparse-checkout set <PATH> [...<PATH>]" command. The toplevel files are included as part of "cone mode" which is the recommended mode for sparse checkouts. In our case we specify the ".prow" folder (inRepoConfigDirName) which is the only path to make sure we get those inrepoconfig files checked out. Sadly, for Git versions 2.32 (which we currently use in our components), the toplevel files are *not* included by default. So we have to specify it separately, which is why we have inRepoConfigFileName also in SparseCheckoutDirs. In Git 2.41 (probably since 2.36) specifying inRepoConfigFileName will make Git exit with an error because Git will see that the `.prow.yaml` is a file, not a folder [1]. So before we upgrade our components to use Git 2.36+ we have to delete the inRepoConfigFileName from this list. [1] git/git@4ce5043
- Loading branch information
Linus Arver
committed
Aug 17, 2023
1 parent
21f8136
commit d44c183
Showing
6 changed files
with
222 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters