@@ -121,18 +121,6 @@ func ParseBuilderID(id string, needVersion bool) (string, string, error) {
121
121
serrors .ErrorInvalidFormat , id )
122
122
}
123
123
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
-
136
124
// IsValidBuilderTag validates if the given ref is a valid builder tag.
137
125
func IsValidBuilderTag (ref string , testing bool ) error {
138
126
// Extract the pin.
@@ -142,9 +130,15 @@ func IsValidBuilderTag(ref string, testing bool) error {
142
130
}
143
131
144
132
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 )
147
140
}
141
+ return nil
148
142
}
149
143
150
144
// Valid semver of the form vX.Y.Z with no metadata.
0 commit comments