From 2a28b37b3c2cf59b4d13ddd6c7157d699b04da4b Mon Sep 17 00:00:00 2001 From: Rhomel Chinsio Date: Wed, 22 Jan 2020 16:57:39 +0900 Subject: [PATCH] fix: place '-' as last character in regex class --- api/builtins/ImageTagTransformer.go | 9 +++------ .../builtin/imagetagtransformer/ImageTagTransformer.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/api/builtins/ImageTagTransformer.go b/api/builtins/ImageTagTransformer.go index a0d4f8f87..4754196c0 100644 --- a/api/builtins/ImageTagTransformer.go +++ b/api/builtins/ImageTagTransformer.go @@ -1,8 +1,6 @@ // Code generated by pluginator on ImageTagTransformer; DO NOT EDIT. // pluginator {unknown 1970-01-01T00:00:00Z } - - package builtins import ( @@ -24,7 +22,6 @@ type ImageTagTransformerPlugin struct { FieldSpecs []types.FieldSpec `json:"fieldSpecs,omitempty" yaml:"fieldSpecs,omitempty"` } - func (p *ImageTagTransformerPlugin) Config( _ *resmap.PluginHelpers, c []byte) (err error) { p.ImageTag = types.Image{} @@ -147,8 +144,8 @@ func (p *ImageTagTransformerPlugin) findContainers(obj map[string]interface{}) e } func isImageMatched(s, t string) bool { - // Tag values are limited to [a-zA-Z0-9_.-{}]. - pattern, _ := regexp.Compile("^" + t + "(@sha256)?(:[a-zA-Z0-9_.-{}]*)?$") + // Tag values are limited to [a-zA-Z0-9_.{}-]. + pattern, _ := regexp.Compile("^" + t + "(@sha256)?(:[a-zA-Z0-9_.{}-]*)?$") return pattern.MatchString(s) } @@ -184,5 +181,5 @@ func split(imageName string) (name string, tag string) { } func NewImageTagTransformerPlugin() resmap.TransformerPlugin { - return &ImageTagTransformerPlugin{} + return &ImageTagTransformerPlugin{} } diff --git a/plugin/builtin/imagetagtransformer/ImageTagTransformer.go b/plugin/builtin/imagetagtransformer/ImageTagTransformer.go index 0da708a2b..54c0c07c9 100644 --- a/plugin/builtin/imagetagtransformer/ImageTagTransformer.go +++ b/plugin/builtin/imagetagtransformer/ImageTagTransformer.go @@ -148,8 +148,8 @@ func (p *plugin) findContainers(obj map[string]interface{}) error { } func isImageMatched(s, t string) bool { - // Tag values are limited to [a-zA-Z0-9_.-{}]. - pattern, _ := regexp.Compile("^" + t + "(@sha256)?(:[a-zA-Z0-9_.-{}]*)?$") + // Tag values are limited to [a-zA-Z0-9_.{}-]. + pattern, _ := regexp.Compile("^" + t + "(@sha256)?(:[a-zA-Z0-9_.{}-]*)?$") return pattern.MatchString(s) }