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

- 4,254
- 1
- 29
- 46
-
1this is exactly what I'm looking for. https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#sleep-sleep – Kevin Nov 09 '20 at 18:45
-
Thanks, great answer. I think this answer must be accepted answer – Ramil Aliyev 007 Jul 21 '23 at 15:52
You can add sleep
command (on Unix) in the test build action before test execution.
-
4
-
1This solution is definitely not platform independent and should be avoided at least when using Jenkins Pipelines. – Yuri Dec 12 '19 at 08:15
If you mean to know how to sleep between those build steps you can use sleep
with Execute shell
type.
sleep 30s

- 20,295
- 14
- 115
- 184
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
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)

- 5,172
- 34
- 67
- 113
-
You saved the day mate !! ... thanks, this is a good solution !! – Carlos Saltos Jun 23 '21 at 07:55
-
Good to see it can help, this is the best official way for those who does not use pipelines (and have access to the UI). Otherwise I think Yuri's answer is the best one for pipelines. – рüффп Jun 23 '21 at 17:39
I just added a Powershell step to run script with Start-Sleep -sec 240

- 26,737
- 24
- 105
- 146

- 51
- 1
- 1
all previous answers are correct, here is more detailed info for linux envirnment.
Search you existing Job Configuration for "Add build step"
Select Execute Shell and then add sleep some_number.

- 21,260
- 6
- 105
- 81