-
Notifications
You must be signed in to change notification settings - Fork 1.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
🌱 Remove redirection handling in repository_github client #7951
🌱 Remove redirection handling in repository_github client #7951
Conversation
retryError = errors.New("unexpected redirect: http.DefaultClient should be able to handle redirects in DownloadReleaseAsset") | ||
return true, 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.
Could also be
retryError = errors.New("unexpected redirect: http.DefaultClient should be able to handle redirects in DownloadReleaseAsset") | |
return true, nil | |
return false, errors.New("unexpected redirect: http.DefaultClient should be able to handle redirects in DownloadReleaseAsset") |
but would then require to handle the error in L378.
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.
We could follow the pattern we have above:
retryError = errors.New("unexpected redirect: http.DefaultClient should be able to handle redirects in DownloadReleaseAsset")
return false, retryError
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.
Fixed 👍
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.
Thx!
/test help |
@chrischdi: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
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. |
/test pull-cluster-api-e2e-informing-main |
retryError = errors.New("unexpected redirect: http.DefaultClient should be able to handle redirects in DownloadReleaseAsset") | ||
return true, 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.
We could follow the pattern we have above:
retryError = errors.New("unexpected redirect: http.DefaultClient should be able to handle redirects in DownloadReleaseAsset")
return false, retryError
4fee5f4
to
1211850
Compare
Thx! /lgtm |
LGTM label has been added. Git tree hash: 492f0ff49e8228dc6646185f905b626275c23a9d
|
/test pull-cluster-api-e2e-informing-main |
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.
Thank you for working on this!
Overall LGTM. Just one comment.
1211850
to
9b77a34
Compare
9b77a34
to
8144820
Compare
The passed http.DefaultClient already handles redirects inside go-githubs DownloadReleaseAsset.
8144820
to
5d805b5
Compare
Forgot to revert |
Thank you! /lgtm /assign @fabriziopandini |
LGTM label has been added. Git tree hash: 617f820ef94fe3dccf404cf94cd42fcf5ccdb998
|
@chrischdi thanks for the cleanup! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
The passed http.DefaultClient already handles redirects inside go-githubs DownloadReleaseAsset.
What this PR does / why we need it:
This PR simplifies the logic for the function
downloadFilesFromRelease
in cmd/clusterctl/client/repository/repository_github.go .Passing
nil
instead ofhttp.DefaultClient
in https://github.com/chrischdi/cluster-api/blob/4fee5f49b81e0eee228a4e1968bb00843564eeaa/cmd/clusterctl/client/repository/repository_github.go#L381 would result in returning an error instead of manually resolving the redirect.However this should only ever be the case if either:
http.DefaultClient
changes its behaviour to not follow redirects anymorego-github
changes its behaviour to not follow redirects anymorenil
)All three cases should get catched at the added unit test.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #7942