-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Use go-getter only for archive fetches #3297
Use go-getter only for archive fetches #3297
Conversation
Hi @thatsmydoing. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: thatsmydoing The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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'm reasonably confident this does the right thing and that go-getter will fallback to the git cloner when provided a git repo but succeed when provided with an archive url.
go-getter and git cloning has a number of issues regarding url formats #2538 (comment) and performance #3244 (comment)
@@ -71,17 +71,21 @@ func getRemoteTarget(rs *remoteTargetSpec) error { | |||
log.Fatalf("Error getting wd: %s", err) | |||
} | |||
|
|||
httpGetter := &getter.HttpGetter{ | |||
Netrc: true, | |||
} |
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.
This is copied from how the default getters are defined https://github.com/hashicorp/go-getter/blob/7e54fdc668a3c829d0349517e4b4b74cb04060c0/get.go#L63-L65
api/loader/getter.go
Outdated
new(getter.GitHubDetector), | ||
new(getter.GitDetector), | ||
new(getter.BitBucketDetector), | ||
Mode: getter.ClientModeDir, |
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.
Remote bases must be directories containing a kustomization.yaml
file so there's no sense in fetching a single file.
new(getter.GitDetector), | ||
new(getter.BitBucketDetector), | ||
Mode: getter.ClientModeDir, | ||
Detectors: []getter.Detector{}, |
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.
The detectors were only used to transform git style urls but we don't want to handle those here.
please rebase |
6504477
to
a3f6a05
Compare
The whole getter / cloner flow is getting hard to follow. |
I think the flow is mostly described in kustomize/api/loader/loader.go Lines 15 to 34 in 0ecbd59
and kustomize/api/loader/fileloader.go Lines 175 to 195 in 0ecbd59
which is, given a url, try to download it with This PR does not change the flow. All it does is make The flow could definitely be improved though. It might make more sense to use the cloner first and then fall back to
Could you point me to a url where it hangs?
The meanings are described here https://godoc.org/github.com/hashicorp/go-getter#ClientMode. It was previously set to |
I think I don't remember exactly if resources fetching is based on getter or not. Please double check this does not break with the |
While bases and resources are merged, I don't think the behavior changed. Only "bases" can be remote in much the same way that only "bases" can be referenced via parent directories. Neither of
work with kustomize 3.8.7 |
It seems I gave a bad example because the getter doesn't follow redirection at the moment .
The above should work though. |
Ah, this feature is described in https://github.com/kubernetes-sigs/kustomize/blob/master/examples/loadHttp.md and the related issue #970 This will most likely break that. I'll look into it. |
On further testing, 3.8.7 does support redirects. I don't know why it failed the first time I tried. I might have accidentally used a different version. I also realized that the http fetching is not done by go-getter but by kustomize itself so this PR should not affect fetching remote resources. The reason that |
a3f6a05
to
2188fe9
Compare
/test kustomize-presubmit-master |
@thatsmydoing: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
2188fe9
to
28b49c9
Compare
/retest |
@thatsmydoing: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Ah. There were linting errors so I just fixed them and rebased. |
@thatsmydoing: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This is no longer necessary as of #3586 |
This is another attempt to address #2538. This uses go-getter only to fetch archives via http. Otherwise, it uses the git cloner to clone repositories. Having 2 different ways of cloning git repositories was a big cause of confusion with url formats and we address this by just removing go-getter as an option entirely.