Groovy Script: Display the build- locking entries in all jobs (Build Blocker Plugin)

67 views
Skip to first unread message

newInHere

unread,
Jul 27, 2015, 5:05:43 AM7/27/15
to Jenkins Users
Hello Users,

finally i´d like to create a groovy script, which shows all Build-Blocking Entries of an Job.
Im trying to learn groovy at the moment and my script is only a first try  =) 

The entries i want to read per groovy script looks like this in the job-Config:



At the moment my script should show all properties of each job. But at that point i´ve an first issue, the script shows that some Jobs have a Build-Blocker Property but the output looks like this:

Class       : class hudson.plugins.project_inheritance.projects.InheritanceProject
Name        : _StartEnvironment (NEU)
Root Dir    : C:\app\tools\Jenkins\jobs\_StartEnvironment (NEU)
URL        
: job/_StartEnvironment%20(NEU)/
Absolute URL: http://scwc37486:8080/job/_StartEnvironment%20(NEU)/
Property: hudson.plugins.buildblocker.BuildBlockerProperty@1872b47
Property: hudson.plugins.throttleconcurrents.ThrottleJobProperty@12a6f35

As far as i understand the script displays the instances of the properties, but i´d like to get the Re-Ex-Strings  ".*test.* , .*build.*" ?

How can i get the values of the "hudson.plugins.buildblocker.BuildBlockerProperty" ?

In the javadoc of "job-Property" i haven´t found a method or a atttribute therefore ( or probably i haven´t understood it right..)
Unfortunately i haven´t found an example which could help me..

Thank you for your Support !

Greetz
Michael


My script :

hudson.model.Hudson.instance.items.each{ job ->
  println
("Class       : ${job.class}")
  println
("Name        : ${job.name}")
  println
("Root Dir    : ${job.rootDir}")
  println
("URL         : ${job.url}")
  println
("Absolute URL: ${job.absoluteUrl}")
 
  jobProperties
=job.getAllProperties()
  jobProperties
.each{ prop ->
    println
("Property: ${prop}")      
 
}  
  println
("")
  println
("")
  println
("")
   
}
 



Reply all
Reply to author
Forward
0 new messages