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
9af1551c
Commit
9af1551c
authored
Dec 22, 2020
by
Marcel Amirault
Committed by
Achilleas Pipinellis
Dec 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add clarification to colons in scripts
parent
1e1b44a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+26
-3
No files found.
doc/ci/yaml/README.md
View file @
9af1551c
...
@@ -615,10 +615,33 @@ job:
...
@@ -615,10 +615,33 @@ job:
```
```
Sometimes,
`script`
commands must be wrapped in single or double quotes.
Sometimes,
`script`
commands must be wrapped in single or double quotes.
For example, commands that contain a colon (
`:`
) must be wrapped in
quotes
.
For example, commands that contain a colon (
`:`
) must be wrapped in
single quotes (
`'`
)
.
The YAML parser needs to interpret the text as a string rather than
The YAML parser needs to interpret the text as a string rather than
a "key: value" pair. Be careful when using special characters:
a "key: value" pair.
`:`
,
`{`
,
`}`
,
`[`
,
`]`
,
`,`
,
`&`
,
`*`
,
`#`
,
`?`
,
`|`
,
`-`
,
`<`
,
`>`
,
`=`
,
`!`
,
`%`
,
`@`
,
`` ` ``
.
For example, this script uses a colon:
```
yaml
job
:
script
:
-
curl --request POST --header 'Content-Type
:
application/json' "https://gitlab/api/v4/projects"
```
To be considered valid YAML, you must wrap the entire command in single quotes. If
the command already uses single quotes, you should change them to double quotes (
`"`
)
if possible:
```
yaml
job
:
script
:
-
'
curl
--request
POST
--header
"Content-Type:
application/json"
"https://gitlab/api/v4/projects"'
```
You can verify the syntax is valid with the
[
CI Lint
](
../lint.md
)
tool.
Be careful when using these special characters as well:
-
`{`
,
`}`
,
`[`
,
`]`
,
`,`
,
`&`
,
`*`
,
`#`
,
`?`
,
`|`
,
`-`
,
`<`
,
`>`
,
`=`
,
`!`
,
`%`
,
`@`
,
`` ` ``
.
If any of the script commands return an exit code other than zero, the job
If any of the script commands return an exit code other than zero, the job
fails and further commands are not executed. Store the exit code in a variable to
fails and further commands are not executed. Store the exit code in a variable to
...
...
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