Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible in Jenkins to add sleep time between build actions?

I am starting a JBoss server in Jenkins as a build action. The next action runs a set of tests. I need to add sleeptime between the two actions. Does anyone know how to do this easily?

like image 359
user1340582 Avatar asked Nov 14 '12 11:11

user1340582


People also ask

How to set build timeout in Jenkins?

Global configurationGo to Manage Jenkins and then Configure System . Under the item Global Build Time Out you can activate a global timeout which will be applied to any job. Choose your timeout strategy, the duration and add actions which should be executed at timeout.

How do I add a delay in Jenkins?

There is a "Quiet Period" option in the Advanced Project Options available. You can enter a value of 300 (its in seconds) to delay the start of the job by 5 mins. Update: now this Quiet Period option is a check box in Build Triggers option.

How do I put Jenkins to sleep?

There is a built-in feature in Jenkins to put a sleep but it is not easy to find it because they call it differently. You can see there is a Quiet period setting in the advanced project options that is "executed" before the current job (project).

What is quiet period in Jenkins?

What is the Quiet period configuration in Jenkins? When this option is non-zero, newly triggered builds of this project will be added to the queue, but Jenkins will wait for the specified period of time (in seconds ) before actually starting the build.


4 Answers

It is possible to use sleep step in your Jenkins Pipeline. The step is included in Pipeline: Basic Steps.

Example:

steps {
  sleep time: 250, unit: 'MILLISECONDS'
}
like image 191
Yuri Avatar answered Sep 20 '22 20:09

Yuri


You can add sleep command (on Unix) in the test build action before test execution.

like image 36
Shurik Avatar answered Sep 18 '22 20:09

Shurik


There is a built-in feature in Jenkins to put a sleep but it is not easy to find it because they call it differently.

On the following screenshot

screenshot

You can see there is a Quiet period setting in the advanced project options that is "executed" before the current job (project).

If you have 3 jobs you can as well set this setting for jobs 2 and 3 which will make:

job1 -> (sleep -> job2) -> (sleep -> job3)
like image 33
рüффп Avatar answered Sep 19 '22 20:09

рüффп


all previous answers are correct, here is more detailed info for linux envirnment.

  1. Search you existing Job Configuration for "Add build step"

  2. Select Execute Shell and then add sleep some_number.

enter image description here enter image description here

like image 25
grepit Avatar answered Sep 17 '22 20:09

grepit