The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Copy Artifact Plugin

copyArtifacts: Copy artifacts from another project

  • projectName
    Name of source project for copying of artifact(s).

    If a Maven project is specified, artifacts from all of its modules will be copied. Enter JOBNAME/MODULENAME here to copy from a particular module; you may copy/paste this from the URL for that module when browsing Jenkins. Example: MyMavenJob/my.group$MyModule

    If a multiconfiguration (matrix) project is specified, artifacts from all of its configurations will be copied, each into a subdirectory with the name of the configuration as seen in its URL when browsing Jenkins. Example: If target directory is given as fromMatrix then the copy could create $WORKSPACE/fromMatrix/label=slaveA/dist/mybuild.jar and $WORKSPACE/fromMatrix/label=slaveB/dist/mybuild.jar.
    To copy from a particular configuration, enter JOBNAME/AXIS=VALUE,.. as seen in the URL for that configuration. Example: MyMatrixJob/jdk=Java6u17
    To copy artifacts from one matrix project to another, use a parameter to select the matching configuration in the source project. Example: OtherMatrixJob/jdk=$jdk
    • Type: String
  • excludes (optional)
    Specify paths or patterns of artifacts to exclude, even if specified in "Artifacts to copy". Can be blank.
    • Type: String
  • filter (optional)
    Relative paths to artifact(s) to copy or leave blank to copy all artifacts. This works just as a filter, and doesn't care whether all specified artifacts really exists. Check the /artifact/ browser of a build to see the relative paths to use here, as the build page typically hides intermediate directories. Can use wildcards like module/dist/**/*.zip, and use comma (followed by optional whitespace) to separate multiple entries. See the @includes of Ant fileset for the exact format. May also contain references to build parameters like $PARAM.
    • Type: String
  • fingerprintArtifacts (optional)
    • Type: boolean
  • flatten (optional)
    • Type: boolean
  • optional (optional)
    • Type: boolean
  • parameters (optional)

    Jobs may be filtered to select only builds matching particular parameters or other build variables. Use PARAM=VALUE,... to list the parameter filter; this is the same syntax as described for multiconfiguration jobs in Project name except with parameters instead of axis values. For example, FOO=bar,BAZ=true examines only builds that ran with parameter FOO set to bar and the checkbox for BAZ was checked.

    You shoudn't use "Build selector for Copy Artifact" parameters here, as it doesn't preserve compatibility when you upgrade plugins, and doesn't work for builds built before upgrading.

    • Type: String
  • resultVariableSuffix (optional)
    The build number of the selected build will be recorded into the variable named COPYARTIFACT_BUILD_NUMBER_(SUFFIX) for later build steps to reference. You can specify that suffix part for that variable here.

    If not specified, the source project name will be used instead (in all uppercase, and sequences of characters other than A-Z replaced by a single underscore).

    Example:

    Source project name Suffix to be used
    Project-ABC PROJECT_ABC
    tool1-release1.2 TOOL_RELEASE_
    • Type: String
  • selector (optional)
    How to select the build to copy artifacts from, such as latest successful or stable build, or latest "keep forever" build. Other plugins may provide additional selections.
    The build number of the selected build will be recorded in the environment for later build steps to reference. For details, see the help of "Result variable suffix" in "Advanced" section.
      Nested Choice of Objects
    • downstream
      • upstreamProjectName

        Copy artifacts from a build that is a downstream of a build of the specified project. You can use variable expressions.

        Downstream builds are found using fingerprints of files. That is, a build that is triggerd from a build isn't always considered downstream, but you need to fingerprint files used in builds to let Jenkins track them.

        Note: "Downsteram build of" is applicable only to AbstractProject based projects (both upstream and downstream projects).

        AbstractProject based projects:
        Freestyle projects
        Multi-configuration projects
        Maven projects
        Non AbstractProject based projects:
        Pipeline jobs (aka. Workflow jobs)

        • Type: String
      • upstreamBuildNumber
        The number of the build to find its downstream build. You can also specify display names. You can use variable expressions.
        • Type: String
    • lastCompleted
      • $class: 'MultiJobBuildSelector'
        • buildParameter
          • parameterName
            Name of the "build selector" parameter. A parameter with this name should be added in the build parameters section above. There is a special parameter type for choosing the build selector.

            You can pass not only the parameter name, but also the parameter value itself. This is useful especially used with workflow-plugin.

            • Type: String
        • permalink
          • id
            • Type: String
        • $class: 'PromotedBuildSelector'
          • level
            • Type: int
        • latestSavedBuild
          • specific
            • buildNumber
              While this selector is for build numbers (e.g. "22" for build #22), you can also resolve build parameters or environment variables (e.g. "${PARAM}"). The display name of a build and permalinks (e.g. "lastSuccessfulBuild", "lastBuild"...) can be used as well.
              • Type: String
          • lastSuccessful
            • stable (optional)
              • Type: boolean
          • upstream
            • fallbackToLastSuccessful
              • Type: boolean
            • upstreamFilterStrategy
              Jenkins launches only one build when multiple upstreams triggered the same project at the same time. This field specifies from which upstream build to copy artifacts in those cases. "Use the oldest" copies artifacts from the upstream build with the smallest build number (that is, oldest). "Use the newest" copies artifacts from the upstream build with the largest build number (that is, newest). The default value is "Use global setting", which behaves as configured in "Manage Jenkins" > "Configure System".
              • Values: UseGlobalSetting, UseOldest, UseNewest
            • allowUpstreamDependencies
              • Type: boolean
          • workspace
          • target (optional)
            Target base directory for copy, or leave blank to use the workspace. Directory (and parent directories, if any) will be created if needed. May contain references to build parameters like $PARAM.
            • Type: String

          Was this page helpful?

          Please submit your feedback about this page through this quick form.

          Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

              


          See existing feedback here.