Reputation: 4690
I have a project in Jenkins (lets call 'Project B') which copies artifacts from another project ('Project A') and repackages them. To copy the artifacts I'm using the Copy Artifact Plugin.
In Project A I am using the Build Name Setter Plugin to set a display name for our build; and would like to do the same in Project B.
Since Project B is just a re-packaging of Project A's artifacts I would like them to share the same display name. As far as I can tell, Copy Artifact Plugin only gives me a variable for the build number. It would be ideal to have a variable with the build display name of Project A so I can assign it as the build display name for Project B.
Question:
How can I get the display name of a build on another project with the build number?
Upvotes: 0
Views: 1492
Reputation: 51768
If you are using groovy, you can a Execute sustem Groovy Script
.
Inside this script, you can access the current build via build
, more importantly you have access the jenkins instance via jenkins.model.Jenkins.instance
.
This will give you access to the majority of stuff in jenkins, including the list of jobs via in jenkins.model.Jenkins.instance.getItems()
which you can search and get builds for each job.
Upvotes: 1