On Monday, March 2, 2015 at 11:52:29 AM UTC+1, John Carbasse wrote:
Hello,
Is it possible, in Jenkins or by a plugin, to forbid builds for a period
(12h-14h for exemple) ?
Ideally, I look for a global parameter, I have too many jobs for set it
for each.
Thanks for your time
We did it
After pasting it, I noticed that the Groovy script could use a bit of
refactoring to make it a bit cleaner:
import jenkins.model.*
import hudson.model.*
def c = new GregorianCalendar()
def hour = c.get(Calendar.HOUR_OF_DAY)
def jobPattern = _Deploy_PR*
def matchedJobs =
Another option if you want to do it programmatically could be to use an API
call via url hit to take machines offline, then put them back online. The
general format of the call should be available pretty easily with a web
search, but we use something like this in a curl call when wanting to take
Just be aware that jobs that are scheduled to run during that period are still
scheduled, and you see them waiting in the Build Queue.
Also, be careful if you have slaves configured “take this slave on-line when in
demand, and off-line when idle”. If you have a job that Is tied to a particular
Sounds like the Slave Squatter plugin could help:
https://wiki.jenkins-ci.org/display/JENKINS/Slave+Squatter+Plugin
On 02/03/15 02:52, John Carbasse wrote:
Hello,
Is it possible, in Jenkins or by a plugin, to forbid builds for a period
(12h-14h for exemple) ?
Ideally, I look for a global