Skip to content

Tag rules syntax

Tag rules follow the doublestar (aka globstar: **) matching pattern. Regex is unfortunately unsupported.

Patterns

doublestar supports the following special terms in the patterns:

Special TermsMeaningExample patternExample matchesExample doesn't matchReason
*matches any sequence of characters (excludes /)env-*/app

env-prod/app

env-dev/app

env-prod/sub/appOnly matches the single directory level
**matches any sequence of characters (includes /)**/redis

lib/redis

proj/cache/redis

lib/redis-proxyMatches any path ending in exactly /redis
?matches any single character (excludes /)qa-team?/*qa-team0
qa-team9
qa-team10/appForces a single digit/letter suffix
[class]matches any single character against a class of characters (See below) (excludes /)see below
{alt1,alt2,...}matches a sequence of characters if one of the comma-separated alternatives matchesrelease-{beta,rc}

release-beta

release-rc

release-alphaalpha is not an alternative

Any character with a special meaning can be escaped with a backslash (\).

Character classes support the following:

ClassMeaningExample patternExample matchesExample doesn't matchReason
[abc]matches any single character within the setservice-[ab]service-a
service-b
service-cc is not in Character class [ab]
[a-z]
[0-9]
matches any single character in the rangebuild-[0-9]build-1
build-7
build-aa not in range
[^class]matches any single character which does not match the classrelease-[^9]*release-1.0release-9.09 is excluded from the class

Example for common tag pattern: Semantic Versioning (SemVer):

This is the most common versioning strategy (e.g., v1.0.1, 1.5.2).

This pattern uses alt-matches with an empty alt option, matching "nothing":

  • The pattern {v,} matches v or an empty string ("nothing") which means it can match strings which start with v or not.
  • The pattern [0-9]{,[0-9],[0-9][0-9]} matches a single digit (always) and one of 3 alt options: empty, single digit, or two digits; this gives us a matching pattern between 0 to 999
  • This limits us to to max version of v999.999.999 which should suffice for most usage. If not enough, just add another alt choice with more digits: [0-9]{,[0-9],[0-9][0-9],[0-9][0-9][0-9]}
GoalPatternMatchesDoes Not Match
Strict 3-part SemVer with optional v prefix{v,}[0-9]{,[0-9],[0-9][0-9]}.[0-9]{,[0-9],[0-9][0-9]}.[0-9]{,[0-9],[0-9][0-9]}

v1.5.9

7.10.3

1.250.22

v1
v1.0
latest