How to add a timeout step to Jenkins Pipeline

0 votes

Hi Guys,

I have created a pipeline Job in Jenkins. I want to add one timeout step to the pipeline. Can anyone help me with this?

Dec 8, 2020 in Jenkins by akhtar
• 38,260 points
5,010 views

1 answer to this question.

0 votes

Hi@akhtar,

You can execute the code inside the block with a determined time out limit. If the time limit is reached, an exception is thrown, which leads to aborting the build. You can add the below code.

timeout(20) {
  node {
    sh 'foo'
  }
}
answered Dec 8, 2020 by MD
• 95,460 points

Related Questions In Jenkins

0 votes
2 answers

how to execute a shell script post build step in Jenkins?

You could use the Post Build Task Plugin ...READ MORE

answered Jul 31, 2019 in Jenkins by Sirajul
• 59,230 points
29,466 views
0 votes
1 answer

How to change the image that the slave uses for a jenkins pipeline?

Hi@akhtar, You can specify the Docker images directly ...READ MORE

answered Oct 22, 2020 in Jenkins by MD
• 95,460 points
1,081 views
+4 votes
7 answers

How to set the pipeline name and description for a Jenkinsfile?

You can rename pipeline jobs in jenkins ...READ MORE

answered Oct 11, 2018 in Jenkins by Hannah
• 18,520 points
36,367 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,035 views
+2 votes
1 answer
+5 votes
3 answers

How to trigger a Jenkins pipeline A in another Jenkins pipeline B?

You can run the following code, its ...READ MORE

answered Jul 5, 2018 in Jenkins by Sophie may
• 10,620 points
119,653 views
0 votes
1 answer

How to create a Jenkins Pipeline?

Hi@akhtar, To create a basic Pipeline through Jenkins ...READ MORE

answered Jul 7, 2020 in Jenkins by MD
• 95,460 points
832 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