File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 15
15
package v1
16
16
17
17
import (
18
+ "path/filepath"
18
19
"strings"
19
20
20
21
"github.com/pkg/errors"
@@ -23,18 +24,19 @@ import (
23
24
24
25
// common functions for webhooks
25
26
26
- func validatePluginImage (image , expectedName string , expectedMinVersion * version.Version ) error {
27
- parts := strings .SplitN (image , ":" , 2 )
27
+ func validatePluginImage (image , expectedImageName string , expectedMinVersion * version.Version ) error {
28
+ // Ignore registry, vendor and extract the image name with the tag
29
+
30
+ parts := strings .SplitN (filepath .Base (image ), ":" , 2 )
28
31
if len (parts ) != 2 {
29
32
return errors .Errorf ("incorrect image field %q" , image )
30
33
}
31
- namespacedName := parts [0 ]
34
+
35
+ imageName := parts [0 ]
32
36
versionStr := parts [1 ]
33
37
34
- parts = strings .Split (namespacedName , "/" )
35
- name := parts [len (parts )- 1 ]
36
- if name != expectedName {
37
- return errors .Errorf ("incorrect image name %q. Make sure you use '<vendor>/%s:<version>'" , name , expectedName )
38
+ if imageName != expectedImageName {
39
+ return errors .Errorf ("incorrect image name %q. Make sure you use '<vendor>/%s:<version>'" , imageName , expectedImageName )
38
40
}
39
41
40
42
ver , err := version .ParseSemantic (versionStr )
You can’t perform that action at this time.
0 commit comments