content_image/660374.jpg
// Declarative // pipeline { agent none ① stages { stage('Example Build') { agent { docker 'maven:3-alpine' } ② steps { echo 'Hello, Maven' sh 'mvn --version' } } stage('Example Test') { agent { docker 'openjdk:8-jre' } ③ steps { echo 'Hello, JDK' sh 'java -version' } } } } // Script // 

① Defining agent none  at the top-level of the Pipeline ensures that an Executor will not be assigned unnecessarily. Using agent none  also forces each stage  section contain its own agent  section. 

② Execute the steps in this stage in a newly created container using this image. 

③ Execute the steps in this stage in a newly created container using a different image from the previous stage. 

## post 

The post  section defines one or more additional steps that are run upon the completion of a Pipeline’s or stage’s run (depending on the location of the post  section within the Pipeline). post  can support one of the following post-condition blocks: always , changed , failure , success , unstable , and aborted . These condition blocks allow the execution of steps within the post  section depending on the completion status of the Pipeline or stage. 

<img src='content_image/660374.jpg'>

## Conditions 

always 

Run the steps in the post  section regardless of the completion status of the Pipeline’s or stage’s run. 

