Stages
Stages are a primitive that allow you to group together steps to be called at once in order to avoid repetition in the pipeline template.
Stages are defined by through the stages
key, with subkeys becoming available as steps within your pipeline template.
A common example would be creating a continuous integration stage:
stages{
continuous_integration{
unit_test
static_code_analysis
build
scan_artifact
}
}
and then in your template:
continuous_integration()
deploy_to dev
Stage Context
It can be helpful for steps to understand if they are being executed as part of a stage and if so, which stage and what parameters, if any, were passed to the stage.
Steps are autowired with a stageContext
variable that can be used to access this information.
Property | Description |
---|---|
|
The name of the stage being executed. Is |
|
A map of named parameters passed to the stage. Is an empty map if not being executed as part of a stage or if no parameters were passed to the stage. |