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
5e30c45a
Commit
5e30c45a
authored
Nov 05, 2019
by
Marcel Amirault
Committed by
Evan Read
Nov 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify before and after script details
parent
b36e26cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+14
-22
No files found.
doc/ci/yaml/README.md
View file @
5e30c45a
...
...
@@ -259,34 +259,26 @@ For more information, see see [Available settings for `services`](../docker/usin
> Introduced in GitLab 8.7 and requires GitLab Runner v1.2.
`before_script`
is used to define
the command that should be run before all
job
s, including deploy jobs, but after the restoration of
[
artifacts
](
#artifacts
)
.
`before_script`
is used to define
a command that should be run before each
job
, including deploy jobs, but after the restoration of any
[
artifacts
](
#artifacts
)
.
This must be an an array.
`after_script`
is used to define the command that will be run after all
jobs, including failed ones. This must be an an array
.
Scripts specified in
`before_script`
are concatenated with any scripts specified
in the main
[
`script`
](
#script
)
, and executed together in a single shell
.
Scripts specified in
`before_script`
are:
`after_script`
is used to define the command that will be run after each
job, including failed ones. This must be an an array.
-
Concatenated with scripts specified in the main
`script`
. Job-level
`before_script`
definition override global-level
`before_script`
definition
when concatenated with
`script`
definition.
-
Executed together with main
`script`
script as one script in a single shell
context.
Scripts specified in
`after_script`
:
Scripts specified in
`after_script`
are executed in a new shell, separate from any
`before_script`
or
`script`
scripts. As a result, they:
-
Have a current working directory set back to the default.
-
Are executed in a shell context separated from
`before_script`
and
`script`
scripts.
-
Because of separated context, cannot see changes done by scripts defined
in
`before_script`
or
`script`
scripts, either:
-
In shell. For example, command aliases and variables exported in
`script`
scripts.
-
Outside of the working tree (depending on the Runner executor). For example,
software installed by a
`before_script`
or
`script`
scripts.
It's possible to overwrite the globally defined
`before_script`
and
`after_script`
-
Have no access to changes done by scripts defined in
`before_script`
or
`script`
, including:
-
Command aliases and variables exported in
`script`
scripts.
-
Changes outside of the working tree (depending on the Runner executor), like
software installed by a
`before_script`
or
`script`
script.
It's possible to overwrite a globally defined
`before_script`
or
`after_script`
if you set it per-job:
```
yaml
...
...
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