Commit 73aee958 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add docs on pattern matching syntax in variables expression

parent c1377c6c
No related merge requests found
......@@ -530,6 +530,13 @@ 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.
### Unsupported predefined variables
Because GitLab evaluates variables before creating jobs, we do not support a
......
......@@ -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`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment