use GetTagName from release

pull/13775/head
Predrag Rogic 2022-03-13 01:33:02 +00:00
parent eff4a18375
commit 88acdd018d
No known key found for this signature in database
GPG Key ID: F1FF5748C4855229
1 changed files with 6 additions and 11 deletions

View File

@ -158,24 +158,19 @@ func supportedKubernetesVersions(minver, maxver string, prereleases bool) (relea
if err != nil {
return nil, err
}
for _, r := range rls {
// extract version from release name (eg, "Kubernetes v1.22.0-beta.2" => "v1.22.0-beta.2")
v := r.GetName()
t := strings.Fields(v)
if len(t) > 1 {
v = t[len(t)-1]
}
if !semver.IsValid(v) {
for _, rl := range rls {
ver := rl.GetTagName()
if !semver.IsValid(ver) {
continue
}
if !prereleases && r.GetPrerelease() {
if !prereleases && rl.GetPrerelease() {
continue
}
// skip out-of-range versions
if (minver != "" && semver.Compare(minver, v) == 1) || (maxver != "" && semver.Compare(v, maxver) == 1) {
if (minver != "" && semver.Compare(minver, ver) == 1) || (maxver != "" && semver.Compare(ver, maxver) == 1) {
continue
}
releases = append(releases, v)
releases = append(releases, ver)
}
if resp.NextPage == 0 {
break