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

"Unable to find a build" when using DownstreamBuildSelector with Jenkins Pipelines

      Given two basic Jenkins Pipelines:

      //Pipeline 'a'

      stage 'stage'
          node{
              build 'b'
              step([$class: 'CopyArtifact', projectName: 'b', selector: [$class: 'DownstreamBuildSelector', upstreamBuildNumber: env.BUILD_NUMBER, upstreamProjectName: env.JOB_NAME]])
          }
      

      //Pipeline 'b'

      stage 'stage'
          node{
              writeFile file: 'target/b.txt', text: 'b'
              archive includes:'target/b.txt'
          }
      

      Copy artifact cannot find the right build from the Pipeline, consistently returning:

      ERROR: Unable to find a build for artifact copy from: b
      Finished: FAILURE

      It doesn't work when removing the env.XYZ variables and passing in hard-coded values either.

          [JENKINS-33577] "Unable to find a build" when using DownstreamBuildSelector with Jenkins Pipelines

          Andy Pemberton created issue -
          Andy Pemberton made changes -
          Description Original: Given two very basic Jenkins Pipelines:

          //Pipeline 'a'

          {code:java}
          stage 'stage'
              node{
                  build 'b'
                  step([$class: 'CopyArtifact', projectName: 'b', selector: [$class: 'DownstreamBuildSelector', upstreamBuildNumber: env.BUILD_NUMBER, upstreamProjectName: env.JOB_NAME]])
              }
          {code}


          //Pipeline 'b'

          {code:java}
          stage 'stage'
              node{
                  writeFile file: 'target/b.txt', text: 'b'
                  archive includes:'target/b.txt'
              }
          {code}

          Copy artifact cannot find the right build from the Pipeline, consistently returning:

          ERROR: Unable to find a build for artifact copy from: b
          Finished: FAILURE

          It doesn't work when removing the env.XYZ variables and passing in hard-coded values either.
          New: Given two basic Jenkins Pipelines:

          //Pipeline 'a'

          {code:java}
          stage 'stage'
              node{
                  build 'b'
                  step([$class: 'CopyArtifact', projectName: 'b', selector: [$class: 'DownstreamBuildSelector', upstreamBuildNumber: env.BUILD_NUMBER, upstreamProjectName: env.JOB_NAME]])
              }
          {code}


          //Pipeline 'b'

          {code:java}
          stage 'stage'
              node{
                  writeFile file: 'target/b.txt', text: 'b'
                  archive includes:'target/b.txt'
              }
          {code}

          Copy artifact cannot find the right build from the Pipeline, consistently returning:

          ERROR: Unable to find a build for artifact copy from: b
          Finished: FAILURE

          It doesn't work when removing the env.XYZ variables and passing in hard-coded values either.
          Jesse Glick made changes -
          Labels New: workflow
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 80 (Web Link)" [ 14078 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-31576 [ JENKINS-31576 ]
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-29913 [ JENKINS-29913 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-33578 [ JENKINS-33578 ]
          Jesse Glick made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-36152 [ JENKINS-36152 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 169529 ] New: JNJira + In-Review [ 198628 ]
          Andrew Bayer made changes -
          Labels Original: workflow New: pipeline workflow

            Unassigned Unassigned
            apemberton Andy Pemberton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: