diff options
author | Evan Read <eread@gitlab.com> | 2019-05-28 21:53:49 +0000 |
---|---|---|
committer | Evan Read <eread@gitlab.com> | 2019-05-28 21:53:49 +0000 |
commit | 9daae83fdd14d2cfb5b4b9651cae178884892ac7 (patch) | |
tree | 67cc3dd3878a19b90390c3bbbc330224d0dca36a /doc | |
parent | d7e106b7b98563394f548cf1da6b59e1644fd5b8 (diff) | |
parent | ec1a4032d3cc64293d65485b8ffe84462c1959a9 (diff) | |
download | gitlab-ce-9daae83fdd14d2cfb5b4b9651cae178884892ac7.tar.gz |
Merge branch 'patch-49' into 'master'
Improve documentation of RegExp in CI/CD job ref patterns
See merge request gitlab-org/gitlab-ce!28139
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ci/yaml/README.md | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 8667eacd3d5..18c85618b1b 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -386,17 +386,12 @@ job: - branches@gitlab-org/gitlab-ce except: - master@gitlab-org/gitlab-ce - - release/.*@gitlab-org/gitlab-ce + - /^release/.*$/@gitlab-org/gitlab-ce ``` The above example will run `job` for all branches on `gitlab-org/gitlab-ce`, except `master` and those with names prefixed with `release/`. -NOTE: **Note:** -Because `@` is used to denote the beginning of a ref's repository path, -matching a ref name containing the `@` character in a regular expression -requires the use of the hex character code match `\x40`. - If a job does not have an `only` rule, `only: ['branches', 'tags']` is set by default. If it doesn't have an `except` rule, it is empty. @@ -415,6 +410,28 @@ job: only: ['branches', 'tags'] ``` +#### Regular expressions + +Because `@` is used to denote the beginning of a ref's repository path, +matching a ref name containing the `@` character in a regular expression +requires the use of the hex character code match `\x40`. + +Only the tag or branch name can be matched by a regular expression. +The repository path, if given, is always matched literally. + +If a regular expression shall be used to match the tag or branch name, +the entire ref name part of the pattern has to be a regular expression, +and must be surrounded by `/`. +(With regular expression flags appended after the closing `/`.) +So `issue-/.*/` won't work to match all tag names or branch names +that begin with `issue-`. + +TIP: **Tip** +Use anchors `^` and `$` to avoid the regular expression +matching only a substring of the tag name or branch name. +For example, `/^issue-.*$/` is equivalent to `/^issue-/`, +while just `/issue/` would also match a branch called `severe-issues`. + ### Supported `only`/`except` regexp syntax CAUTION: **Warning:** |