Hi Anyone can help me with logic catch in Jenkins? When deployment fails I need the script!

0 votes
Hi Anyone can help me with a logic catch in Jenkins? When a deployment fails I need the script!
Oct 6 in Jenkins by anonymous
• 19,570 points
36 views

1 answer to this question.

0 votes
Try this:

node { stage('Example') { try { sh 'exit 1' } catch (exc) { echo 'Something failed, I should sound the klaxons!' throw } } }

This should help!
answered Oct 6 by Adil

Related Questions In Jenkins

0 votes
1 answer

Jenkins : Problem with the script. Can anyone help?

Refer to user input... In Jenkins pipeline ...READ MORE

answered Sep 30 in Jenkins by Adil Abdullah Khan
45 views
0 votes
2 answers
0 votes
1 answer

How can I create global macros and templates in jenkins job builder?

you can append the path to the ...READ MORE

answered Apr 2, 2018 in Jenkins by ajs3033
• 7,280 points
680 views
0 votes
1 answer

How do I pass value from my Fake # script to the host build server (Jenkins)

You can use the EnvInject plugin to pass environment ...READ MORE

answered Jul 11, 2018 in Jenkins by Kalgi
• 2,620 points
387 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
809 views
+2 votes
1 answer