Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
73aee958
Commit
73aee958
authored
May 15, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docs on pattern matching syntax in variables expression
parent
c1377c6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
doc/ci/variables/README.md
doc/ci/variables/README.md
+7
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+12
-1
No files found.
doc/ci/variables/README.md
View file @
73aee958
...
@@ -530,6 +530,13 @@ Below you can find supported syntax reference:
...
@@ -530,6 +530,13 @@ Below you can find supported syntax reference:
`$STAGING` value needs to a string, with length higher than zero.
`$STAGING` value needs to a string, with length higher than zero.
Variable that contains only whitespace characters is not an empty variable.
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
### Unsupported predefined variables
Because GitLab evaluates variables before creating jobs, we do not support a
Because GitLab evaluates variables before creating jobs, we do not support a
...
...
doc/ci/yaml/README.md
View file @
73aee958
...
@@ -344,10 +344,11 @@ job:
...
@@ -344,10 +344,11 @@ job:
kubernetes
:
active
kubernetes
:
active
```
```
Example of using variables expressions:
Example
s
of using variables expressions:
```
yaml
```
yaml
deploy
:
deploy
:
script
:
cap staging deploy
only
:
only
:
refs
:
refs
:
-
branches
-
branches
...
@@ -356,6 +357,16 @@ deploy:
...
@@ -356,6 +357,16 @@ deploy:
-
$STAGING
-
$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
]
.
Learn more about variables expressions on
[
a separate page
][
variables-expressions
]
.
## `tags`
## `tags`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment