30
votes

I have 2 jobs in Jenkins: QA and Dev. In Dev job I checked "Build after other projects are built" option and set project name = QA so that QA job will be built after Dev job is built. But in my particular situation I need that QA job started building in 5 mins after Dev job is built. How can I do it? maybe I can add some build step with some data to add this delay ?

TIA, Anna

4
Why wait 5 minutes? Is it possible to directly check to see if whatever you're waiting for has happened/completed?thekbb
Because your job, if dependent upon multiple upstream triggers, could end up kicking off multiple jobs vs. just one. If EITHER trigger happens, wait xx minutes THEN run the job. This appears to be exactly what we are needing right now. A) Upstream project rolls out change. B) 10 downstream modules are triggered to ensure nothing breaks. C) Bottom job, connected to them all, also needs to run, but only once. Quiet time of, say, 10 minutes, appears to be what's needed.gregturn

4 Answers

50
votes

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.

5
votes

If you're using the REST api, you can add a url get value like this:

http://jenkins/job/jobname/build?delay=4

That will delay 4 seconds and start the job.

2
votes

I know the topic is quite old but in case sameone else is looking for an answer here it is. When using parametrized build remember to escape "&". You can replace it with: "%26" or put the whole URL in quotes. It will work. Please also remember to use delay as first parameter.

0
votes

To make it simpler with out worrying about trigger from URL using delay, there is a Jenkins plugin which helps to schedule the job on the fly with as much as delay you need (configurable when ever you are running build and supports parameterized builds as well). For more details please check Plugin Pags, GitHub