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, 2020 in Jenkins by anonymous
• 19,610 points
664 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, 2020 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, 2020 in Jenkins by Adil Abdullah Khan
1,243 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,300 points
1,878 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,680 points
1,388 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,061 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP