-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat: add git sparse checkout #14272
base: master
Are you sure you want to change the base?
Conversation
9d2a848
to
10ab6f3
Compare
Well go-git/go-git#90 🤷🏻 |
I made it work using the |
Note: #11198 |
2e35678
to
bcc409a
Compare
|
||
_, err = m.runCmd("init") | ||
if err != nil { | ||
return err | ||
} | ||
_, err = repo.CreateRemote(&config.RemoteConfig{ | ||
Name: git.DefaultRemoteName, | ||
URLs: []string{m.repoURL}, | ||
}) | ||
return err | ||
|
||
_, err = m.runCmd("remote", "add", git.DefaultRemoteName, m.repoURL) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I HAD
to do this to make things work! Whatever that package is doing, it doesn't work with sparse checkout
bcc409a
to
6da09a9
Compare
@@ -62,6 +62,8 @@ type gitRefCache interface { | |||
type Client interface { | |||
Root() string | |||
Init() error | |||
SparseCheckout(patterns []string) error | |||
Pull(revision string) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need this one over Fetch
with sparse checkout
6da09a9
to
fbe696b
Compare
61748e1
to
888a97f
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #14272 +/- ##
==========================================
- Coverage 49.98% 49.95% -0.03%
==========================================
Files 266 266
Lines 46043 46110 +67
==========================================
+ Hits 23016 23036 +20
- Misses 20770 20805 +35
- Partials 2257 2269 +12
☔ View full report in Codecov by Sentry. |
0622736
to
f017698
Compare
err = gitClient.Fetch(revision) | ||
if err != nil { | ||
return status.Errorf(codes.Internal, "Failed to checkout revision %s: %v", revision, err) | ||
// TODO: I am not sure about this Pull vs Fetch situation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need help here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested sparse checkouts using fetch instead of pull? Seems like it would be ideal to limit the number of ways we retrieve repo contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried locally using a git
bash script and didn't work for me. I used https://github.com/derrickstolee/sparse-checkout-example repo for it.
I am gonna try again, but I think it is require, I am not sure.
I leaved a note here to follow on it
271e714
to
6689cd5
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com> add notes run codegen asd asdsadasda run codegen Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
6689cd5
to
594056a
Compare
sb.WriteString(pattern) | ||
} | ||
|
||
if _, err := m.runCmd("sparse-checkout", "set", sb.String()); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this correctly, the sparse-checkout setting "sticks." I think this means we need to prevent concurrent access to the repo for apps where the sparse checkout setting doesn't match (similar to what we do for Kustomize apps where some on-disk state is set by a config option).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does stick to the configuration of a git repo. Gonna be working on that next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note:
git sparse-checkout disable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to what we do for Kustomize apps where some on-disk state is set by a config option
@crenshaw-dev I am gonna be digging into it, but in the meantime, could you share some links to where the Kustomize version is happening?
Trying to figure out how the codebase reasons about such a situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a semaphore mechanism to allow multiple read-only processes to use a repo checkout out at a particular commit at the same time.
I think this is the field which determines whether concurrency is allowed for a certain repo operation:
argo-cd/reposerver/repository/repository.go
Line 259 in c200d0c
allowConcurrent bool |
As the repo size is growing I am seeing error I hope this issue will resolve this error, is this already released in any specific version? |
No description provided.