Below is script i'm using to get the success builds and filtering then to get only matching label.
please help me out how to list of success builds promoted?
any help could be appreciable. thanks in advance.
def jobname="test"
def list=[]
hudson.model.AbstractProject<?, ?> otherJob = jenkins.model.Jenkins.getInstance().getItemByFullName(jobname, hudson.model.AbstractProject.class)
hudson.util.RunList<?> builds = otherJob.getBuilds().overThresholdOnly(hudson.model.Result.SUCCESS.promoted-builds.SUCCESS)
builds.limit(20).each{run ->
switch( run.displayName ) {
case ~/^5.*.*.*/ :
list.add(run.displayName)
break
default :
break
}
}
list