Allow version comparison errors (#6257)

This commit is contained in:
inksnw
2024-10-31 11:41:08 +08:00
committed by GitHub
parent 9b56a88f93
commit 299c0d46db

View File

@@ -298,7 +298,12 @@ func UpdateLatestAppVersion(ctx context.Context, client runtimeclient.Client, ap
klog.Warningf("failed to parse version: %s, use first version %s", v.Spec.VersionName, latestAppVersion)
continue
}
if parsedVersion.GT(semver.MustParse(strings.TrimPrefix(latestAppVersion, "v"))) {
oldLatestAppVersion, err := semver.Parse(strings.TrimPrefix(latestAppVersion, "v"))
if err != nil {
klog.Warningf("failed to parse oldLatestAppVersion: %s", latestAppVersion)
continue
}
if parsedVersion.GT(oldLatestAppVersion) {
latestAppVersion = v.Spec.VersionName
}
}