Cluster-wide Copy Artifacts

Written by: Baptiste Mathus
2 min read

CloudBees Jenkins Enterprise lets you operate many Client Controllers (multiple Jenkins controllers) from a central place: CloudBees Jenkins Operations Center.

This is, for example, very useful to be able to spread the load across teams, and leave teams to decide more freely which plugins they want to install, how they want to configure their jobs on their controller, and so on.

Use case

When you start using multiple controller, and you are writing a deployment pipeline for example, you may need to reference artifacts coming from a build on another controller.

This is now possible with the 2.7 release of CloudBees Jenkins Enterprise . A specific new Pipeline step is provided, and it is also supported on FreeStyle, Maven and Matrix job types.

How do I use it?

It is very straightforward. For a full explanation, please refer to the official documentation. You can use fine-grained options to select the build you need in the upstream job (e.g. the last build, stable or not, some build by its number, etc.).

From a Pipeline script

For example, let’s say I would like to get www.war file generated by the last completed build (i.e. even if failed, and will exclude the currently running builds) from the build-www-app-job job, located in the team-www-folder folder. And I want this to time out after a maximum of 1 hour, 2 minutes and 20 seconds. Here is how I could do it:

node('linux && x86') {
   from: 'jenkins://41bd83b2f8fe36fea7d8b1a88f9a70f3/team-www-folder/build-www-app-job',
   includes: '**/target/www.war',
   selector: [$class: 'LastCompletedRemoteBuildSelector'],
   timeout: '1h 2m 20s'

In general, for such a complex case, it is strongly recommended to use the Pipeline Snippet Generator to generate the right code. See an illustration about that below:

From a FreeStyle Job

Just look for the new Copy archived artifacts from remote/local jobs step, then you will find a very similar UI to the one above in the Pipeline Snippet Generator:

And there’s more!

This is just a quick overview. To get the full picture, please refer to the official “Cluster-wide copy artifacts” documentation .

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.