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 = Jenkins.instance.items.findAll { job -> job.name =~ /
$jobPattern/ }
matchedJobs.each { job ->
if ((hour >= 10) && (hour < 16)) {
println "Enabling matching job ${job.name}"
job.enable()
} else {
println "Disabling matching job ${job.name}"
job.disable()
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/773ee7d1-3d27-441e-9dca-433df4aa30dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.