diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2019-06-12 00:31:44 +0300 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2019-06-12 09:44:17 +0300 |
commit | f4b5f930ff7252468c69cf4decbbb05d44ba3b71 (patch) | |
tree | 25facd3466acfa641ffc427b6b633f701b10bae9 /doc/ci/yaml/README.md | |
parent | 9bf141cf718ab9ca770c3bd6b7e2c6719cbe9da7 (diff) |
Leave clear notices about after_script execution context
We frequently see new issues mentioning that something defined
in `before_script` or `script` doesn't work with `after_script`.
Our documentation mentions that first two are concatenated and
executed together, why the third one is executed in a separated
shell context. But it looks like it's not clear enough.
Since this misunderstanding of how scripts are being executed
is repeated frequently, let's make it more clear in docs.
Diffstat (limited to 'doc/ci/yaml/README.md')
-rw-r--r-- | doc/ci/yaml/README.md | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index fa4b0378f61..cb7a93e0cc7 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -215,10 +215,20 @@ This can be an array or a multi-line string. `after_script` is used to define the command that will be run after all jobs, including failed ones. This has to be an array or a multi-line string. -The `before_script` and the main `script` are concatenated and run in a single context/container. -The `after_script` is run separately. The current working directory is set back to -default. Depending on the executor, changes done outside of the working tree might -not be visible, e.g. software installed in the `before_script`. +Script specified in `before_script` is: + +- Concatenated with script 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. + +Script specified in `after_script`: + +- Have a current working directory set back to the default. +- Is 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: + - in shell - for example, command aliases and variables exported in `script` script, + - outside of the working tree (depending on the Runner executor) - for example, software installed + by a `before_script` or `script` script. It's possible to overwrite the globally defined `before_script` and `after_script` if you set it per-job: |