Skip to content

Commit 26b35df

Browse files
committed
update
Signed-off-by: laurentsimon <[email protected]>
1 parent 33c7417 commit 26b35df

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

verifiers/utils/builder.go

+8-14
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,6 @@ func ParseBuilderID(id string, needVersion bool) (string, string, error) {
121121
serrors.ErrorInvalidFormat, id)
122122
}
123123

124-
func isValidTestingBuilderRef(pin string) error {
125-
// Tags on trusted repositories should be a valid semver with version
126-
// core including all three parts and no build identifier.
127-
versionCore := strings.Split(pin, "-")[0]
128-
if !semver.IsValid(pin) ||
129-
len(strings.Split(versionCore, ".")) != 3 ||
130-
semver.Build(pin) != "" {
131-
return fmt.Errorf("%w: %s: version tag not valid", serrors.ErrorInvalidRef, pin)
132-
}
133-
return nil
134-
}
135-
136124
// IsValidBuilderTag validates if the given ref is a valid builder tag.
137125
func IsValidBuilderTag(ref string, testing bool) error {
138126
// Extract the pin.
@@ -142,9 +130,15 @@ func IsValidBuilderTag(ref string, testing bool) error {
142130
}
143131

144132
if testing {
145-
if err := isValidTestingBuilderRef(pin); err != nil {
146-
return err
133+
// Tags on trusted repositories should be a valid semver with version
134+
// core including all three parts and no build identifier.
135+
versionCore := strings.Split(pin, "-")[0]
136+
if !semver.IsValid(pin) ||
137+
len(strings.Split(versionCore, ".")) != 3 ||
138+
semver.Build(pin) != "" {
139+
return fmt.Errorf("%w: %s: version tag not valid", serrors.ErrorInvalidRef, pin)
147140
}
141+
return nil
148142
}
149143

150144
// Valid semver of the form vX.Y.Z with no metadata.

0 commit comments

Comments
 (0)