user6136315 user6136315 - 1 month ago 19x
Groovy Question

List total number of current builds running for a job on Jenkins

I would like to monitor how many concurrent builds running for a job on Jenkins using groovy script console.

Using this I'm able to get the last build status. I need to get the count of current builds that are running. Can someone help me on this?

def item = hudson.model.Hudson.instance.getItem("<JOB-NAME>")
def build = item.getLastBuild()

println build.isInProgress()


Try this: