September 2018
Intermediate to advanced
764 pages
20h 6m
English
Every declarative pipeline must start with the pipeline directive. Within the pipeline directive are, usually, the agent, stages, and step directives.
The agent directive tells Jenkins to allocate an executor and workspace for this part of the Pipeline. A workspace is simply a directory in the filesystem where Jenkins can work with the files to run the build, and an executor is simply a thread that executes the task. When you use the agent directive, it will also download the source repository and save it to the workspace, so that the code is available for subsequent stages.
A typical declarative pipeline might look like this:
#!/usr/bin/env groovypipeline { agent { docker { image 'node' args '-u root' } } stages ...Read now
Unlock full access