0

I am trying to copy the artifacts from one build (Coverity Test), to another build (MainBuild).

MainBuild uses a declarative pipeline. I have added the following step to build Coverity Test as the final step in MainBuild.

stage('Coverity Test') {
    when { expression { params.CoverityReport ==true } }
    steps{
        build job: 'Coverity Test',
        parameters: [
            string(name: 'COVERITY_TOOL_HOME',
                  value: '/home/coverity/cov-analysis-linux64-2020.03'),
            string(name: 'GIT_BRANCH', value: "${env.PROJ_GIT_BRANCH}")
        ]

        copyArtifacts filter: 'CoverityCrit*Issues.txt', fingerprintArtifacts: true, projectName: 'Coverity Test', selector: specific ('${BUILD_NUMBER}')
    }        
}

The files CoverityCrit*Issues are created in a script through the Coverity Test build, I have confirmed that these files display as artifacts of the Coverity Test in Jenkins.

The copyArtifacts command returns an error "ERROR: Unable to find a build for artifact copy from: Coverity Test"

I used this as an example to create the copyArtifacts command

What am I doing wrong?

Enter Strandman
  • 329
  • 2
  • 14
  • You have single quotes around specific ('${BUILD_NUMBER}'), so the variable isn't expanded, but you don't need quotes or ${}, just do: specific(BUILD_NUMBER) – trash80 May 27 '21 at 16:53
  • Also, value: "${env.PROJ_GIT_BRANCH}" can be just: value: env.PROJ_GIT_BRANCH – trash80 May 27 '21 at 16:54

1 Answers1

0

Inside

selector: specific ('${BUILD_NUMBER}')

You need to use double quotes "" instead of single quotes ''.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Sol He
  • 16
  • 1