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,170 points
250 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,060 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
• 58,990 points
18,109 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,060 points
59 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,550 points
22,216 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
947 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,530 points
40,584 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,060 points
93 views