Groovy script to get the success builds which are promoted of particular jenkins job.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Groovy script to get the success builds which are promoted of particular jenkins job.

raja saggam
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

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/fb755e9e-b131-4087-a40b-d8c78bc767e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.