0

Is there any API available from jenkins to get all builds custom label for a specific job set by 'Set Build Name'? If it is achievable thru some programmatic scripts to get these custom build labels list for a job, please share the ideas if APIs are not available.

CSchulz
  • 10,882
  • 11
  • 60
  • 114
Srinivas
  • 321
  • 2
  • 5
  • 18
  • 'Set Build Name' does not set labels. It sets the name. ....Your question is too vague. Please provide more examples on what are you trying to achieve. – Jayan Jan 24 '16 at 03:04
  • yes, I am looking for the API to find out all builds display names (set by Build Name Setter plugin') on a particular job. – Srinivas Jan 25 '16 at 06:21

1 Answers1

1

build-name-setter-plugin changes the display name of the AbstractBuild object. what you can do is get all the builds of the specific job, and compare their display names to the job's display name. for example:

jenkins = Jenkins.getInstance()
job = jenkins.getItem(jobName)
blds = job.getBuilds()
def result = blds.findAll { it.displayName!=job.displayName}
println result
Tidhar Klein Orbach
  • 2,896
  • 2
  • 30
  • 47