Fix: handlet invalid semver

Signed-off-by: LiHui <andrewli@yunify.com>
This commit is contained in:
LiHui
2021-03-24 16:42:06 +08:00
parent 46e064870e
commit 231d2213d3
3 changed files with 41 additions and 34 deletions

View File

@@ -32,7 +32,6 @@ import (
"kubesphere.io/kubesphere/pkg/utils/stringutils"
"path"
"regexp"
"sort"
"strings"
"time"
)
@@ -320,10 +319,16 @@ func convertApp(app *v1alpha1.HelmApplication, versions []*v1alpha1.HelmApplicat
} else {
out.CategorySet = AppCategorySet{}
}
if versions != nil && len(versions) > 0 {
sort.Sort(AppVersions(versions))
out.LatestAppVersion = convertAppVersion(versions[len(versions)-1])
} else {
for _, version := range versions {
if app.Status.LatestVersion == version.GetVersionName() {
// find the latest version, and convert its format
out.LatestAppVersion = convertAppVersion(version)
break
}
}
if out.LatestAppVersion == nil {
out.LatestAppVersion = &AppVersion{}
}