Help us shape the future of Go! Take the 2026 Go Developer Survey

imagepattern

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsImagePattern

func IsImagePattern(image string) bool

func NewMatcher

func NewMatcher(pattern string) (*regexp.Regexp, []namedMatchingGroup, error)

NewMatcher returns a Regexp that can be used to match an image or image tag against a pattern. The supplied pattern is NOT a regex. It is acorn's own custom syntax with the following characteristics: - Assumed to be valid docker tag characters: 0-9A-Za-z_.- - Outside of the special matching/sorting groups, a tag must match the pattern exactly - There are three special matching/sorting groups: #, *, and ** - ** indicates a portion of the tag doesn't need to match the pattern and won't be considered for sorting. It is the "wildcard" - * indicates a portion of the tag that will be matched and sorted alphabetically - # indicates a portion of the tag that will be matched and sorted numerically

Here are a few simple examples of patterns and what they would match: - "v#.#" - Matches: "v1.0", "v2.0" (return as latest). Doesn't match: "v1.alpha", "1.0", "v1.0.0" - "v1.0-*" - Matches: "v1.0-alpha", "v1.0-beta" (returned as latest). Doesn't match: "v1.0" - "v1.#-**" - Matches: "v1.0-cv23jkha", "v1.1-2020-01-01" (returned as latest).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL