Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
    ]);
like image 905
Michael Aigner Avatar asked Sep 06 '16 06:09

Michael Aigner


People also ask

How do you get an artifact in Jenkins?

How to Create an Artifact. In Jenkins, an artifact is created in either Freestyle projects or Pipeline projects. In Freestyle, add the “Archive the artifacts” post-build step. In Pipeline, use the archiveArtifacts step.


1 Answers

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"]
     ])
like image 55
Jocce Nilsson Avatar answered Oct 11 '22 18:10

Jocce Nilsson