DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Securing CI/CD Pipelines Against Supply Chain Attacks: Why Artifacts and Dependencies Matter More Than Ever
  • From 13,000 to 20,000+ Endpoints: Architecting Forensics for the Remote Workforce
  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Stop Using Spring Profiles Per Environment

Trending

  • Microsoft Fabric Throttling: Diagnose Before You Scale
  • LangChainGo vs Genkit Go: Where Genkit Shines
  • One Database, Two Models: Building AI-Friendly Java Applications With MySQL JSON Duality Views
  • ScyllaDB in Enterprise Java: High-Performance NoSQL With Eclipse JNoSQL

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

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.

By 
Baptiste Mathus
·
Mar. 01, 17 · Opinion
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
5.7K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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') {
 copyRemoteArtifacts
 from: 'jenkins://41bd83b2f8fe36fea7d8b1a88f9a70f3/team-www-folder/build-www-app-job',
  includes: '**/target/www.war',
  selector: [$class: 'LastCompletedRemoteBuildSelector'],
  timeout: '1h 2m 20s'
}
  • <instance-id> is the Instance Identity of the source Jenkins server.
  • jenkins:// is the canonical URL format. One can also use the cjp:///path/from/root/of/cjoc URL format, but it requires you to use a “Trusted Master with equivalent security realm” configured on CJOC.

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.

Artifact (UML)

Published at DZone with permission of Baptiste Mathus. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Securing CI/CD Pipelines Against Supply Chain Attacks: Why Artifacts and Dependencies Matter More Than Ever
  • From 13,000 to 20,000+ Endpoints: Architecting Forensics for the Remote Workforce
  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Stop Using Spring Profiles Per Environment

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook