diff options
| author | Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> | 2024-12-04 21:34:58 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-04 11:04:58 -0500 |
| commit | 8076d2005ea625c73604073fca43df38eb675751 (patch) | |
| tree | 1570ba5969882a26e021875da86bee6850a9cfc6 /registry-scanner/pkg/image/matchfunc.go | |
| parent | c3f0eff54daf871fa1c274462b17f5149c11d368 (diff) | |
Add image folder to registry scanner (#952)
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
Diffstat (limited to 'registry-scanner/pkg/image/matchfunc.go')
| -rw-r--r-- | registry-scanner/pkg/image/matchfunc.go | 27 |
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)) +} |
