Created
August 25, 2010 06:50
-
-
Save stigkj/548986 to your computer and use it in GitHub Desktop.
Nice Groovy script for Hudson that checks which jobs are building or in the queue (got this from http://adrian.org.ar/ci/concurrency-in-hudson)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Jobs currently building or in the queue | |
jobs = hudson.model.Hudson.instance.items.findAll{job -> job.isBuilding()} + hudson.model.Hudson.instance.items.findAll{job -> job.isInQueue()} | |
//Keep only the names from the collected job objects | |
jobs = jobs.collect{x -> x.name} | |
//get current job name | |
currentJob = Thread.currentThread().executable.toString().split()[0] | |
//cut current job from the jobs list | |
jobs -= currentJob | |
//decide if there is any running (or waiting) job | |
res = true | |
if ((jobs.size()) > 0) | |
{ | |
res = false | |
println "The following jobs are being executed or waiting for an executor" | |
jobs.each{println it} | |
} | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment