Skip to content

Commit 93b8e09

Browse files
committed
default semver constraint for empty string
Signed-off-by: Zeyuan Cao <[email protected]>
1 parent 49825ec commit 93b8e09

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/argoproj-labs/argocd-image-updater
33
go 1.18
44

55
require (
6-
github.com/Masterminds/semver v1.5.0
6+
github.com/Masterminds/semver/v3 v3.2.0
77
github.com/argoproj/argo-cd/v2 v2.2.7
88
github.com/argoproj/gitops-engine v0.5.2
99
github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0
@@ -39,6 +39,7 @@ require (
3939
github.com/Azure/go-autorest/logger v0.2.1 // indirect
4040
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
4141
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
42+
github.com/Masterminds/semver v1.5.0 // indirect
4243
github.com/PuerkitoBio/purell v1.1.1 // indirect
4344
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
4445
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd h1:sjQovDkwrZp
6868
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
6969
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
7070
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
71+
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
72+
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
7173
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
7274
github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
7375
github.com/Microsoft/hcsshim v0.8.10-0.20200715222032-5eafd1556990/go.mod h1:ay/0dTb7NsG8QMDfsRfLHgZo/6xAJShLe1+ePPflihk=

pkg/image/version.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/argoproj-labs/argocd-image-updater/pkg/options"
88
"github.com/argoproj-labs/argocd-image-updater/pkg/tag"
99

10-
"github.com/Masterminds/semver"
10+
"github.com/Masterminds/semver/v3"
1111
)
1212

1313
// VersionSortMode defines the method to sort a list of tags
@@ -123,6 +123,10 @@ func (img *ContainerImage) GetNewestVersionFromTags(vc *VersionConstraint, tagLi
123123
return nil, err
124124
}
125125
}
126+
} else if vc.Strategy == StrategySemVer {
127+
// The is the special case where an empty string was passed in which
128+
// is equivalent to * or >=0.0.0
129+
semverConstraint, _ = semver.NewConstraint("*")
126130
}
127131
}
128132

pkg/tag/tag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/argoproj-labs/argocd-image-updater/pkg/log"
1010

11-
"github.com/Masterminds/semver"
11+
"github.com/Masterminds/semver/v3"
1212
)
1313

1414
// ImageTag is a representation of an image tag with metadata

0 commit comments

Comments
 (0)