Below is my pipeline script
node(Slave01) {
currentBuild.displayName = "${URL_Name}"
}
stage 'Pt2ctf process'
node(Slave01) {
build job: 'Pt2ctf_16_7', parameters: [string(name: 'URL_Name', value: "${URL_name}"), string(name: 'Display_Name', value: "${Display_Name}")]
}
stage 'add_fields'
node(Slave01) {
build job: 'add_fields_16_7', parameters: [string(name: 'URL_Name', value: "${URL_Name}")]
}
The above groovy script would trigger multiple builds in sequence. I have another build to be run once the sequence is completed. I don't see any post build option in the pipeline job configuration.
Is it possible that we can add few more lines like below:
post
node(Slave01){
build job: 'testing_build'
}
Or do we have any other option? please suggest
Since the post section of a Pipeline is guaranteed to run at the end of a Pipeline's execution, we can add some notification or other steps to perform finalization, notification, or other end-of-Pipeline tasks. See Glossary - Build Status for the different build statuses: SUCCESS, UNSTABLE, and FAILED.
Post Actions are just like other normal stages but that running in specific conditions. Jenkins supports 10 special action conditions which are running when these conditions meet. They are related to run status and can be defined in the post block both for the whole pipeline and per-stage.
You can simply add post
action to your pipeline script, in case of using declarative pipeline.
It is explained in Pipeline syntax reference.
You can add a stage for post build to add post build action in pipeline:
stage 'post-build'
node(Slave01){
build job: 'testing_build'
}
You can use this stage as:
try {
//Stages to be included in build
...
} catch {
...
} finally {
stage 'post-build'
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With