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
8f48a543
Commit
8f48a543
authored
Jan 20, 2021
by
Marcel Amirault
Committed by
Suzanne Selhorn
Jan 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand yaml anchors example
parent
6a362120
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+15
-6
No files found.
doc/ci/yaml/README.md
View file @
8f48a543
...
...
@@ -4450,22 +4450,31 @@ You can use [YAML anchors](#anchors) with [script](#script), [`before_script`](#
and
[
`after_script`
](
#after_script
)
to use predefined commands in multiple jobs:
```
yaml
.some-script
:
&some-script
-
echo "Execute this script in `before_script` sections"
.some-script-before
:
&some-script-before
-
echo "Execute this script in `script` sections"
-
echo "Execute this script first"
.some-script
:
&some-script
-
echo "Execute this script second"
-
echo "Execute this script too"
.some-script-after
:
&some-script-after
-
echo "Execute this script
in `after_script` sections
"
-
echo "Execute this script
last
"
job
_name
:
job
1
:
before_script
:
-
*some-script-before
script
:
-
*some-script
-
echo "Execute something, for this job only"
after_script
:
-
*some-script-after
job2
:
script
:
-
*some-script-before
-
*some-script
-
echo "Execute something else, for this job only"
-
*some-script-after
```
#### YAML anchors for variables
...
...
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