I have a Jenkins deploy job that copies artifacts from a build job. In my deploy job, I am using a groovy script (see below) in an Extensible Choice parameter to present a list of successful builds from that build job in a drop-down. I would like to enhance the groovy script to list only successful builds from that build job. How can I do this?
def builds = []
def job = jenkins.model.Jenkins.instance.getItem(JOB-NAME)
job.builds.each {
def build = it
it.badgeActions.each {
builds.add(build.displayName[1..-1])
}
}
builds.unique();