Over a million developers have joined DZone.

Using Cluster-Wide Copy Artifacts

DZone's Guide to

Using Cluster-Wide Copy Artifacts

When you use multiple Masters and write a deployment pipeline, you may need to reference artifacts from another Master. You can do this with CloudBees Jenkins Enterprise.

· DevOps Zone ·
Free Resource

Is the concept of adopting a continuous everything model a daunting task for your fast moving business? Read this whitepaper to break down and understand one of the key pillars of this model in Continuous Governance: The Guardrails for Continuous Everything.

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

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

Use Case

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

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 full explanations, please refer to the official documentation. You can use fine-grained options to select the build you need in the upstream job (i.e., the last build, stable or not, some build by its number, etc.).

From a Pipeline Script

For example, let’s say that I would like to get a 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. 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. 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.

Are you looking for greater insight into your software development value stream? Check out this whitepaper: DevOps Performance: The Importance of Measuring Throughput and Stability to see how CloudBees DevOptics can give you the visibility to improve your continuous delivery process.

jenkins ,devops ,clusters ,artifacts ,cloudbees ,masters

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}