user1340582
user1340582

Reputation: 19699

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?

Upvotes: 16

Views: 65400

Answers (6)

Shurik
Shurik

Reputation: 572

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

Upvotes: 15

Yuri
Yuri

Reputation: 4478

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'
}

Upvotes: 22

grepit
grepit

Reputation: 22382

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

Upvotes: 4

рüффп
рüффп

Reputation: 5448

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)

Upvotes: 8

rkibbe
rkibbe

Reputation: 51

I just added a Powershell step to run script with Start-Sleep -sec 240

Upvotes: 5

Jin Kwon
Jin Kwon

Reputation: 21978

If you mean to know how to sleep between those build steps you can use sleep with Execute shell type.

sleep 30s

Upvotes: 13

Related Questions