I would like to write a system groovy script which inspects the queued jobs in Jenkins, and extracts the build parameters (and build cause as a bonus) supplied as the job was scheduled. Ideas?
Specifically:
def q = Jenkins.instance.queue
q.items.each { println it.task.name }
retrieves the queued items. I can't for the life of me figure out where the build parameters live.
The closest I am getting is this:
def q = Jenkins.instance.queue
q.items.each {
println("${it.task.name}:")
it.task.properties.each { key, val ->
println(" ${key}=${val}")
}
}
This gets me this:
4.1.next-build-launcher:
com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty$ScannerJobPropertyDescriptor@b299407=com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty@5e04bfd7
com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty$DescriptorImpl@40d04eaa=com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty@16b308db
hudson.model.ParametersDefinitionProperty$DescriptorImpl@b744c43=hudson.mod el.ParametersDefinitionProperty@440a6d81
...