Reputation: 4588
I have a pipeline-jenkins also I use a jenkinsfile with several stage, How can I do If in a stage the pipeline fail after that a stage is exacuted? For instance to stop and remove several docker container.
Thanks
Upvotes: 1
Views: 863
Reputation: 7970
try/catch to get the error, finally block to do the "final" stage ?
try {
stage name: "something":
} catch (err) {
// handle errors here ?
} finally {
stage name: "cleanup"
}
Upvotes: 2