Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65138

Copy Artifacts from MultiBranch pipeline fails to find build with specified parameters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • copyartifact-plugin
    • None
    • Jenkins 2.263.3
      copy artifact plugin 1.46

      One of our Multibranch pipeline (using SVN) builds has two parameters:

      // tool pipeline parameters
        parameters {
          string(name: 'SVN_REVISION', defaultValue: 'HEAD', description: 'The revision to checkout')
          choice(name: 'CUSTOMER', choices: [ 'ALL', 'customer1', 'customer2' ])
        }
      

      Another pipeline needs to copy the artifacts from a specific build of this tool: tags/6.1.0, "customer1".

      Copying artifacts from trunk with the specified parameters works:

      // copy HEAD from trunk, hardcoded parameters
      copyArtifacts fingerprintArtifacts: true, flatten: true, parameters: 'CUSTOMER=customer1,SVN_REVISION=HEAD', projectName: 'rnd/tool/trunk', selector: lastSuccessful()
      // Success: Copied 2 artifacts from "rnd » tool » trunk" build number 123
      

      Trunk has other more recent successful builds but build 123 is the last successful that matches the specified parameters.

      It also works when using pipeline parameters:

      // copy HEAD from trunk, using pipeline parameters
      copyArtifacts fingerprintArtifacts: true, flatten: true, parameters: "CUSTOMER=customer1,SVN_REVISION=${TOOL_SVN_REVISION}", projectName: "rnd/tool/${java.net.URLEncoder.encode(TOOL_SVN_BRANCH, "UTF-8")}", selector: lastSuccessful(), target: 'tools'
      // Success: Copied 2 artifacts from "rnd » tool » trunk" build number 123
      

      Copying from a tag without parameters works as well:

      // copy HEAD from tags/6.1.0 without parameters
      copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'rnd/tool/tags%2F6.1.0', selector: lastSuccessful()
      // Copied 3 artifacts from "rnd » tool » tags/6.1.0" build number 9
      

      However copying from a tag with parameters fails. Every one of the following fails with the same error:

      copyArtifacts fingerprintArtifacts: true, flatten: true, parameters: 'CUSTOMER=customer1,SVN_REVISION=HEAD', projectName: 'rnd/tool/tags%2F6.1.0', selector: lastSuccessful()
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, parameters: 'SVN_REVISION=HEAD,CUSTOMER=customer1', projectName: '/rnd/tool/tags%2F6.1.0', selector: lastSuccessful()
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, parameters: 'CUSTOMER=customer1,SVN_REVISION=HEAD', projectName: 'rnd/tool/tags%2F6.1.0', selector: buildParameter('CUSTOMER=customer1')
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'rnd/tool/tags%2F6.1.0', selector: buildParameter('CUSTOMER=customer1')
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'rnd/tool/tags%2F6.1.0', selector: buildParameter('CUSTOMER=customer1,SVN_REVISION=HEAD')
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'rnd/tool/tags%2F6.1.0', selector: buildParameter('SVN_REVISION=HEAD,CUSTOMER=customer1')
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, projectName: 'rnd/tool/tags%2F6.1.0', selector: buildParameter('SVN_REVISION="HEAD",CUSTOMER="customer1"')
      
      copyArtifacts fingerprintArtifacts: true, flatten: true, parameters: 'CUSTOMER=customer1,SVN_REVISION=HEAD', projectName: 'rnd/tool/tags%2F6.1.0', selector: buildParameter('CUSTOMER=customer1,SVN_REVISION=HEAD')
      
      // Failure: ERROR: Unable to find a build for artifact copy from: rnd/tool/tags%2F6.1.0
      

      How can we copy from a specific branch from a MultiBranch pipeline while specifying parameters?

            Unassigned Unassigned
            bram_mertens Bram Mertens
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: