diff --git a/internal/version/version.go b/internal/version/version.go index 00effefa..88b0626c 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -13,6 +13,6 @@ func VersionsMatch(apiVersion string) bool { if len(withoutPatchRelease) < 3 { return false } - majorMinor := strings.Join(withoutPatchRelease[:len(withoutPatchRelease)-1], ".") + majorMinor := strings.Join(withoutPatchRelease[:2], ".") return strings.HasPrefix(strings.TrimPrefix(apiVersion, "v"), strings.TrimPrefix(majorMinor, "v")) } diff --git a/internal/version/version_test.go b/internal/version/version_test.go index 9791717e..e51b64dd 100644 --- a/internal/version/version_test.go +++ b/internal/version/version_test.go @@ -26,4 +26,8 @@ func TestVersion(t *testing.T) { Version = "1.15.4" match = VersionsMatch("v2.15.2") assert.True(t, "versions do not match", !match) + + Version = "1.12.2+cli.rc1" + match = VersionsMatch("v1.12.9") + assert.True(t, "versions do match", match) }