If Job 4 fails delete the running container on Test Server

0 votes
How can I make a conditional statement to delete my container if the previous test step fails?
Nov 24, 2020 in Jenkins by Chris
• 120 points
1,205 views

1 answer to this question.

0 votes

Hi@Chris,

You can use the when keyword to control the condition. If your previous test step fails then you can find the status. Use that status in the when condition and tell if it fails. remove the container. You can run the below command in your playbook with the command module.

docker rm -f $(docker ps -a -q)
answered Nov 24, 2020 by MD
• 95,460 points

Related Questions In Jenkins

0 votes
1 answer

How to deploy the war file in Tomcat Server with Jenkins pipeline job on an windows machine?

Use deploy to container plugin. Go to the ...READ MORE

answered Sep 30, 2020 in Jenkins by Adil Abdullah Khan
4,629 views
0 votes
1 answer

running a Jenkins job on multiple virtual servers.

Your goals can be achieved by using ...READ MORE

answered May 25, 2018 in Jenkins by shubham
• 7,340 points
3,144 views
0 votes
2 answers

will running multiple Jenkins masters on same host increase the performance?

While using one big master, u can ...READ MORE

answered Aug 7, 2018 in Jenkins by Kalgi
• 52,350 points
3,252 views
0 votes
1 answer

how to create a job using jenkins for Sign the puppet certificate on master ?

Take a look at this  https://fullstack-puppet-docs.readthedoc ...READ MORE

answered May 29, 2020 in Jenkins by Sirajul
• 59,230 points
1,126 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,703 views
+1 vote
3 answers

How to auto build a job in jenkins if there is any change in code on Github repository?

To automatically run build on code commit, follow ...READ MORE

answered Jul 31, 2019 in Jenkins by Sirajul
• 59,230 points
78,711 views
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