How to Copy Artifacts from other Jenkins Job from a Pipeline? How to Copy Artifacts from other Jenkins Job from a Pipeline? jenkins jenkins

How to Copy Artifacts from other Jenkins Job from a Pipeline?


I believe that the default is to copy from the last successful job. However, it looks like you currently want the upstream job. Here is a snippet:

copyArtifacts fingerprintArtifacts: true, projectName: 'MyBuildJob', selector: upstream()

I generated this code using the snippet generator. It should exist on the left panel of the classic view of a job. The button text reads "Pipeline Syntax" and the url is "my.jenkins.instance.com/pipeline-syntax/"

Specifying an artifact filter is not required, it will copy all of them. However if you want to keep the filter:

copyArtifacts filter: '_Builds/BuildRelease/archive.zip', fingerprintArtifacts: true, projectName: 'MyBuildJob', selector: upstream()