diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-18 15:08:12 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-18 15:08:12 +0300 |
commit | 46d5ab68b700509e38efc48b8bbe2be128c4f390 (patch) | |
tree | 34570f017d82e8ce420b90a73c9af1783fc1671b /doc/ci | |
parent | e330b709469747c65c3f7d6c13fac0ac8dca0615 (diff) | |
parent | afa245142117a7e90ff6046133a2402fb8c09cb1 (diff) |
Merge branch 'feature/gb/add-regexp-variables-expression' into 'master'
Add support for variables expression regexp syntax
Closes #43601
See merge request gitlab-org/gitlab-ce!18902
Diffstat (limited to 'doc/ci')
-rw-r--r-- | doc/ci/variables/README.md | 10 | ||||
-rw-r--r-- | doc/ci/yaml/README.md | 13 |
2 files changed, 22 insertions, 1 deletions
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index 42367bf13f7..f66b2b374ba 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -530,6 +530,16 @@ Below you can find supported syntax reference: `$STAGING` value needs to a string, with length higher than zero. Variable that contains only whitespace characters is not an empty variable. +1. Pattern matching _(added in 11.0)_ + + > Example: `$VARIABLE =~ /^content.*/` + + It is possible perform pattern matching against a variable and regular + expression. Expression like this evaluates to truth if matches are found. + + Pattern matching is case-sensitive by default. Use `i` flag modifier, like + `/pattern/i` to make a pattern case-insensitive. + ### Unsupported predefined variables Because GitLab evaluates variables before creating jobs, we do not support a diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 2a17a51d7f8..3e77a6f58b7 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -344,10 +344,11 @@ job: kubernetes: active ``` -Example of using variables expressions: +Examples of using variables expressions: ```yaml deploy: + script: cap staging deploy only: refs: - branches @@ -356,6 +357,16 @@ deploy: - $STAGING ``` +Another use case is exluding jobs depending on a commit message _(added in 11.0)_: + +```yaml +end-to-end: + script: rake test:end-to-end + except: + variables: + - $CI_COMMIT_MESSAGE =~ /skip-end-to-end-tests/ +``` + Learn more about variables expressions on [a separate page][variables-expressions]. ## `tags` |