Copying Artifacts Between Builds in a Jenkins Workflow

2 min read

As its name suggests, the copyartifact-plugin provides a build step in support of copying artifacts between Jenkins builds. We recently made updates to this plugin that allow it to be used within a Jenkins Pipeline (will be available in v1.34 of the plugin).

It’s currently available as a “Core Step,” which means you use it through the generic step workflow step, e.g.:

node {
   // setup  env..
    // copy the deployment unit from another Job...
    step ([$class: ' CopyArtifact',
            projectName: ' webapp_build',
           filter: 'target/orders.war']);
    // deploy 'target/orders.war' to an app host
 } 

As you’d guess, the above example simply copies a Java war file artifact from another Jenkins job and deploys it somewhere. All other config options that the copyartifact-plugin supports are also available. The easiest way to test/browse all options is through the Workflow script “Snippet Generator” (available on the workflow configuration screen below the workflow script textarea).

The next obvious step is to provide a “native” copyartifacts workflow step.

 

Tom Fennelly
Engineer
CloudBees


Learn More

Jenkins is one of the preeminent automation tools. Jenkins is extensible by design, using plugins. Plugins are what give Jenkins its great flexibility for automating a wide range of processes on diverse platforms. Jenkins Pipeline builds on that flexibility and rich plugin ecosystem while enabling Jenkins users to write their Jenkins automation as code. This technical guide will show a number of common use cases for plugins with Jenkins Pipeline.

These use cases include:

  • Publishing HTML reports

  • Sending notifications

  • Continuous delivery using Docker

  • Test result interpretation and reporting

Download this technical guide to learn more about and get started with Jenkins Pipeline!

Stay up to date

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