summaryrefslogtreecommitdiff
path: root/registry-scanner/pkg/image/matchfunc.go
diff options
context:
space:
mode:
Diffstat (limited to 'registry-scanner/pkg/image/matchfunc.go')
-rw-r--r--registry-scanner/pkg/image/matchfunc.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/registry-scanner/pkg/image/matchfunc.go b/registry-scanner/pkg/image/matchfunc.go
new file mode 100644
index 0000000..036e6fb
--- /dev/null
+++ b/registry-scanner/pkg/image/matchfunc.go
@@ -0,0 +1,27 @@
+package image
+
+import (
+ "regexp"
+
+ "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/log"
+)
+
+// MatchFuncAny matches any pattern, i.e. always returns true
+func MatchFuncAny(tagName string, args interface{}) bool {
+ return true
+}
+
+// MatchFuncNone matches no pattern, i.e. always returns false
+func MatchFuncNone(tagName string, args interface{}) bool {
+ return false
+}
+
+// MatchFuncRegexp matches the tagName against regexp pattern and returns the result
+func MatchFuncRegexp(tagName string, args interface{}) bool {
+ pattern, ok := args.(*regexp.Regexp)
+ if !ok {
+ log.Errorf("args is not a RegExp")
+ return false
+ }
+ return pattern.Match([]byte(tagName))
+}