Question

In groovy how to check if a particular build is tagged? I'm using this information to mark the build "Keep forever".

I'm using this script to get builds of a particular job:

item=hudson.model.Hudson.instance.getItem("Build")
//build = item.getLastBuild()   
builds = item.getBuilds()   
//println build.getTime()
abcd=""
  builds.each { result=it.getResult().toString().equals("SUCCESS") 
    if (it.getResult().toString().equals("SUCCESS"))
    {
        abcd+= it.getNumber() +","
        }
    println it.isKeepLog()
  }

println abcd[0..-2]
Was it helpful?

Solution

Looking at this page: Jenkins Javadocs, I think you should be able to call '.isTagged()' on a job/run. My groovy console isn't working at the moment, so I can't test it...

If you get it working, please share the result!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top