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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4296b032
Commit
4296b032
authored
Apr 28, 2021
by
Marcel Amirault
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'quotes' into 'master'
Quote bash substitutions See merge request gitlab-org/gitlab!60429
parents
e0adec51
61cff6bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
doc/ci/variables/README.md
doc/ci/variables/README.md
+11
-11
No files found.
doc/ci/variables/README.md
View file @
4296b032
...
...
@@ -43,7 +43,7 @@ predefined variable:
test_variable
:
stage
:
test
script
:
-
echo
$CI_JOB_STAGE
-
echo
"$CI_JOB_STAGE"
```
The script outputs the
`stage`
for the
`test_variable`
, which is
`test`
:
...
...
@@ -88,7 +88,7 @@ job1:
variables
:
TEST_VAR_JOB
:
"
Only
job1
can
use
this
variable's
value"
script
:
-
echo
$TEST_VAR and $TEST_VAR_JOB
-
echo
"$TEST_VAR" and "$TEST_VAR_JOB"
```
Variables saved in the
`.gitlab-ci.yml`
file should store only non-sensitive project
...
...
@@ -114,9 +114,9 @@ name inside another variable:
```
yaml
variables
:
FLAGS
:
'
-al'
LS_CMD
:
'
ls
$FLAGS
$$TMP_DIR'
LS_CMD
:
'
ls
"$FLAGS"
$$TMP_DIR'
script
:
-
'
eval
$LS_CMD
'
# Executes 'ls -al $TMP_DIR'
-
'
eval
"$LS_CMD"
'
# Executes 'ls -al $TMP_DIR'
```
Use the
[
`value` and `description`
](
../yaml/README.md#prefill-variables-in-manual-pipelines
)
...
...
@@ -151,10 +151,10 @@ After you create a variable, you can use it in the `.gitlab-ci.yml` file:
test_variable
:
stage
:
test
script
:
-
echo
$CI_JOB_STAGE
# calls a predefined variable
-
echo
$TEST
# calls a custom variable of type `env_var`
-
echo
$GREETING
# calls a custom variable of type `file` that contains the path to the temp file
-
cat
$GREETING
# the temp file itself contains the variable value
-
echo
"$CI_JOB_STAGE"
# calls a predefined variable
-
echo
"$TEST"
# calls a custom variable of type `env_var`
-
echo
"$GREETING"
# calls a custom variable of type `file` that contains the path to the temp file
-
cat
"$GREETING"
# the temp file itself contains the variable value
```
The output is:
...
...
@@ -366,7 +366,7 @@ CI/CD variable with (`$`):
```
yaml
job_name
:
script
:
-
echo
$CI_JOB_ID
-
echo
"$CI_JOB_ID"
```
### Use variables with PowerShell
...
...
@@ -506,7 +506,7 @@ build:
deploy
:
stage
:
deploy
script
:
-
echo
$BUILD_VERSION
# Output is: 'hello'
-
echo
"$BUILD_VERSION"
# Output is: 'hello'
dependencies
:
-
build
```
...
...
@@ -525,7 +525,7 @@ build:
deploy
:
stage
:
deploy
script
:
-
echo
$BUILD_VERSION
# Output is: 'hello'
-
echo
"$BUILD_VERSION"
# Output is: 'hello'
needs
:
-
job
:
build
artifacts
:
true
...
...
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