Implement Sparse Checkout for GitRepository#1774
Conversation
72d3852 to
7035a58
Compare
GitRepository
@dipti-pai I think we should handle this on our own. We could trim |
7035a58 to
7565fa8
Compare
|
From the abnormal behaviours called out, I'd agree with @stefanprodan on For |
Yes we could verify the dirs and error out in the controller 👍 |
|
Updated the code to handle incorrect user configuration where Once the error in configuration is fixed, the reconciliation succeeds - |
7565fa8 to
d1d2461
Compare
stefanprodan
left a comment
There was a problem hiding this comment.
LGTM
Thanks @dipti-pai 🏅
d1d2461 to
32e40e0
Compare
- Add `.spec.sparseCheckout` and `.status.observedSparseCheckout` fields to `GitRepository`.
- Add controller support to send the sparse checkout directories to go-git via pkg methods.
- Use `.status/observedSparseCheckout` to detect drift in configuration.
- Trim leading "./" in directory paths.
- Validate spec configuration by checking directories specified in spec exist in the cloned repository after successful checkout
- Add tests for testing the observed sparse checkout behavior.
- Add docs describing the new fields.
Signed-off-by: Dipti Pai <diptipai89@outlook.com>
32e40e0 to
61f9eb2
Compare
Sparse Checkout Directories in GitRepositories.
Fixes: #1707
Current behavior worth calling out.
.spec.sparseCheckoutdirectory list includes a directory that does not exist, the underlying go-git checkout method does not return an error and silently continues. See SparseCheckoutDirectories behavior when directory path does not exist go-git/go-git#1500 . This is being handled in the controller..spec.sparseCheckoutdirectory list includes directory with more than one level of nesting, sparse checkout is not honored and all directories at top-level are checked out. Will be fixed bySparseCheckoutDirectoriesworks only for 1st level directory. go-git/go-git#1455.spec.sparseCheckoutuses relative path beginning with a./, the path is ignored and nothing is checked out and no errors are thrown. SeeSparseCheckoutDirectoriesignores relative paths beginning with (./) while checking out git repository go-git/go-git#1506 . This is being handled in source-controller.4.. If
.spec.sparseCheckoutincludes an empty directory, the entire repository is checked out (Expected)