mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Fix: addon compare vela version failure (#3928)
Signed-off-by: StevenLeiZhang <zhangleiic@163.com>
This commit is contained in:
2
go.mod
2
go.mod
@@ -6,6 +6,7 @@ require (
|
||||
cuelang.org/go v0.2.2
|
||||
github.com/AlecAivazis/survey/v2 v2.1.1
|
||||
github.com/FogDong/uitable v0.0.5
|
||||
github.com/Masterminds/semver/v3 v3.1.1
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8
|
||||
github.com/agiledragon/gomonkey/v2 v2.4.0
|
||||
github.com/alibabacloud-go/cs-20151215/v2 v2.4.5
|
||||
@@ -123,7 +124,6 @@ require (
|
||||
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.1.1 // indirect
|
||||
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
|
||||
github.com/Masterminds/squirrel v1.5.2 // indirect
|
||||
|
||||
@@ -34,8 +34,8 @@ import (
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
cueyaml "cuelang.org/go/encoding/yaml"
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"github.com/google/go-github/v32/github"
|
||||
"github.com/hashicorp/go-version"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/xanzy/go-gitlab"
|
||||
"golang.org/x/oauth2"
|
||||
@@ -1416,11 +1416,11 @@ func checkSemVer(actual string, require string) (bool, error) {
|
||||
}
|
||||
smeVer := strings.TrimPrefix(actual, "v")
|
||||
l := strings.ReplaceAll(require, "v", " ")
|
||||
constraint, err := version.NewConstraint(l)
|
||||
constraint, err := semver.NewConstraint(l)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
v, err := version.NewVersion(smeVer)
|
||||
v, err := semver.NewVersion(smeVer)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -758,6 +758,11 @@ func TestCheckSemVer(t *testing.T) {
|
||||
require: ">=v1.3.0-alpha.1",
|
||||
res: false,
|
||||
},
|
||||
{
|
||||
actual: "v1.4.0-alpha.3",
|
||||
require: ">=v1.3.0-beta.2",
|
||||
res: true,
|
||||
},
|
||||
}
|
||||
for _, testCase := range testCases {
|
||||
result, err := checkSemVer(testCase.actual, testCase.require)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user