Michael Aigner
Michael Aigner

Reputation: 5160

Using CopyArtifact to copy from a specific build

I need to copy artifacts from a specific build which is not always the latest. I'm searching for a way to copy the artifacts from a specfic build number.

Does anybody know if it is possible and how i can do that?

I use the following snippet in my pipeline script to copy the latest artifacts:

step ([
        $class: 'CopyArtifact',
        projectName: "myproject",
        filter: '_build/*.zip'
    ]);

Upvotes: 6

Views: 4771

Answers (1)

Jocce Nilsson
Jocce Nilsson

Reputation: 1748

Take a look in the tests of the plugin, there is an example of how to configure a specific selector. If I try to extract it, it would look like:

step([$class: 'CopyArtifact', 
      projectName: "myproject",
      filter: '_build/*.zip'
      selector: 
            [$class: 'SpecificBuildSelector', 
             buildNumber: "123"]
     ])

Upvotes: 8

Related Questions