-
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
🐛 clusterctl: fix goproxy to also return versions for major > 1 #7709
🐛 clusterctl: fix goproxy to also return versions for major > 1 #7709
Conversation
That stage should be unrelated /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.
/lgtm
Should we also fix the code in https://github.com/kubernetes-sigs/cluster-api/blob/main/hack/tools/mdbook/releaselink/releaselink.go ?
We should probably dedupe these two and favor less copying around, wdyt?
/cc @ykakarap |
/area clusterctl |
3203984
to
6b6c73b
Compare
Great point. Did already forget that we've "stolen" that from there :-) I moved it to |
6b6c73b
to
2e5e0c9
Compare
/assign @ykakarap |
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 changes to support >v1 versions looks good.
There is an edge case where this might now work. Example when a go modules jumps from v1 to v3 then the current code will not list the v3 versions as it will stop immediately after v2 is not found. This is a very rare case and I dont know think why someone might want to jump a major version. But, I thought I would point this out anyway.
FYI: This is a breaking change in clusterctl's library but given our compatibility notice for clusterctl we should be fine and no further action is needed.
@@ -58,36 +56,22 @@ func (l ReleaseLink) Process(input *plugin.Input) error { | |||
versionRange := semver.MustParseRange(tags.Get("version")) | |||
includePrereleases := tags.Get("prereleases") == "true" | |||
|
|||
repo, err := vcs.RepoRootForImportPath(gomodule, false) | |||
scheme, host, err := goproxy.GetSchemeAndHost(os.Getenv("GOPROXY")) |
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.
Since now we are reading from GOPROXY
env variable we should account for scheme
and host
being empty strings.
If GOPROXY
envvar is set to direct
or off
we will get an empty scheme
and host
and the code below will fail.
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.
Added returning an error when one of scheme or host is empty to fail.
2e5e0c9
to
8e24add
Compare
Thanks for reviewiewing.
Yes great point! That's why I mentioned it in the office hours and also added the note at the PR description 👍 |
8e24add
to
0deb3a6
Compare
/test pull-cluster-api-e2e-informing-main |
/lgtm |
0deb3a6
to
ad4b17d
Compare
Squashed both commits to a single one. |
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.
Looks good - just a couple nits
Also: * moves goproxy functionality to an internal package * reuses the package also for releaselink * fixes releaselink references for aws
ad4b17d
to
128e6fc
Compare
Thanks @chrischdi for quicky jumping on this issue! |
[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 |
/cherry-pick release-1.3 |
@chrischdi: #7709 failed to apply on top of branch "release-1.3":
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. |
What this PR does / why we need it:
This PR fixes the goproxy client to also list versions of go modules > v1.
The previously used goproxy endpoint only lists versions of major v1.
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 #7700
Additional info:
The goproxy client will not provide the correct results for go based provider which do not follow go module semantical versioning (e.g. tagging v2.0.0 but not setting go.mod to
/v2
. xref. If this is considered as a no-go, I would propose to remove the goproxy implementation instead of fixing it. Such providers are always able to setGOPROXY=off
to allow clusterctl to directly use the github api.