before_script documentation
I'm somewhat confused by the documentation about before_script.
I can read
before_script is used to define the command that should be run before all jobs, including deploy jobs, but after the restoration of artifacts.
What I understand here is that command are executed once before all jobs as opposed to before each jobs.
Then the documentation says:
Scripts specified in before_script are:
- 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
This raise the following questions:
- What is the main script? What does it mean?
- What is a global-level before_script? A script outside of any job? The kind of script that is supposed to be executed before all job? Why would it be concatenated with script definition (that are job level as far as I know) if it's supposed to be executed before all job.
Then there is some sample code :
default:
before_script:
- global before script
job:
before_script:
- execute this instead of global before script
script:
- my command
after_script:
- execute this after my script
Which raise some other questions and remarks:
- the global before script (as indicated in the sample code) does not look like a global before script but rather a default job before_script.
- Is the following
default:
before_script:
- global before script
job:
before_script:
- execute this instead of global before script
script:
- my command
after_script:
- execute this after my script
the same thing as:
before_script:
- global before script
job:
before_script:
- execute this instead of global before script
script:
- my command
after_script:
- execute this after my script
Could someone possibly clarify? Thanks in advance
Edited by Frederic Latour