File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1515package v1
1616
1717import (
18+ "path/filepath"
1819 "strings"
1920
2021 "github.com/pkg/errors"
@@ -23,18 +24,19 @@ import (
2324
2425// common functions for webhooks
2526
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 )
2831 if len (parts ) != 2 {
2932 return errors .Errorf ("incorrect image field %q" , image )
3033 }
31- namespacedName := parts [0 ]
34+
35+ imageName := parts [0 ]
3236 versionStr := parts [1 ]
3337
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 )
3840 }
3941
4042 ver , err := version .ParseSemantic (versionStr )
You can’t perform that action at this time.
0 commit comments