From f0ae77abd5f83a45bd9542428a6028bb9312d4c6 Mon Sep 17 00:00:00 2001 From: Rhomel Chinsio Date: Tue, 3 Mar 2020 05:48:36 +0000 Subject: [PATCH 1/2] allow braces in image tag name (api) --- api/builtins/ImageTagTransformer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/builtins/ImageTagTransformer.go b/api/builtins/ImageTagTransformer.go index 0ce7bd797..f7b2f0112 100644 --- a/api/builtins/ImageTagTransformer.go +++ b/api/builtins/ImageTagTransformer.go @@ -144,8 +144,10 @@ 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_.{}-]. + // Some tools like Bazel rules_k8s allow tag patterns with {} characters. + // More info: https://github.com/bazelbuild/rules_k8s/pull/423 + pattern, _ := regexp.Compile("^" + t + "(@sha256)?(:[a-zA-Z0-9_.{}-]*)?$") return pattern.MatchString(s) } From b33d0f86f0bcc9fda0bc168949fbe1261d2720fe Mon Sep 17 00:00:00 2001 From: Rhomel Chinsio Date: Thu, 5 Mar 2020 06:57:40 +0000 Subject: [PATCH 2/2] fix: add plugin file --- plugin/builtin/imagetagtransformer/ImageTagTransformer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/builtin/imagetagtransformer/ImageTagTransformer.go b/plugin/builtin/imagetagtransformer/ImageTagTransformer.go index 2b1b347b6..0ed721192 100644 --- a/plugin/builtin/imagetagtransformer/ImageTagTransformer.go +++ b/plugin/builtin/imagetagtransformer/ImageTagTransformer.go @@ -148,8 +148,10 @@ 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_.{}-]. + // Some tools like Bazel rules_k8s allow tag patterns with {} characters. + // More info: https://github.com/bazelbuild/rules_k8s/pull/423 + pattern, _ := regexp.Compile("^" + t + "(@sha256)?(:[a-zA-Z0-9_.{}-]*)?$") return pattern.MatchString(s) }