Juan Reina Pascual
Juan Reina Pascual

Reputation: 4588

Stage final after fail the pipeline-jenkins

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

Answers (1)

rasjani
rasjani

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

Related Questions