I would like to extract all jobs and group them by nodes. The goal of this is to have a list of builds to run a script and delete builds.
This is what I try to execute on the script:
def jobs = hudson.model.Hudson.instance.items
nodeName = 'YOUR_NODE_NAME'
jobs.each { job ->
urls = []
job.builds.each { build ->
nodeName == build.builtOnStr && urls << build.absoluteUrl
}
urls && println("${job.name}\n\t${urls.sort().join('\n\t')}")
}
I'm getting an error and I have no ide why, this is the error:
groovy.lang.MissingPropertyException: No such property: builtOnStr for class: org.jenkinsci.plugins.workflow.job.WorkflowRun
Thanks in advance