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

CopyArtifact by buildParameter documentation is unclear

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Fixed but Unreleased (View Workflow)
    • Priority: Trivial
    • Resolution: Won't Fix
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.176.1
      copyartifact 1.43.1
    • Similar Issues:

      Description

      You can see my question on Stack Overflow (I probably should have posted here first).  https://stackoverflow.com/questions/62998712/i-am-unable-to-get-the-jenkins-copyartifact-plugin-with-the-specified-by-a-buil
       
      I am having a hard time figuring out how to get the Jenkins CopyArtifact Plugin to work in the "Specified by a build Parameter" working.  I figured I could pass in a parameter somehow and filter on that parameter. The artifacts are created successfully, but I can't figure out how to specify the parameter to copy the artifact from.

      I have been able to get copyArtifact with the "Latest Successful build" option running, so I know I have the permissions set right and the artifact and parameters are set as I expect.

      I have 3 tasks (ztest1, ztest2, ztest3).

      ztest1:

      • triggers ztest2 (non-blocking) with a Parameter "START_BUILD_NUMBER"=${BUILD_NUMBER}
      • sleep 10 seconds
      • tries to copy the artifact from ztest3 

      ztest2:

      • takes the input parameter (START_BUILD_NUMBER) and triggers ztest3 (non-blocking) with a parameter "START_BUILD_NUMBER"=${START_BUILD_NUMBER}

      ztest3: (I've tried a bunch of different things, but here's my current try)

      • Take the "START_BUILD_NUMBER" and then create a second artifact "BUILD_TOKEN" that utilizes the "START_BUILD_NUMBER"
      • create the artifact
      •  {{echo "ztest START_BUILD_NUMBER ${START_BUILD_NUMBER}" > test.txt
        echo "ztest3 BUILD_NUMBER ${BUILD_NUMBER}" >> test.txt
        echo "ztest BUILD_TOKEN ${BUILD_TOKEN}" >> test.txt}}

      Am I missing anything: My actual use case is a bit more complicated, but this is the simple form that I was trying to use. My actual use case involves an asynchronous process between steps 2 and 3 and multiple entry points, Specifically step 2 can be fired separately, and then don't need to copy the artifact.

      If I have to move to Groovy and a pipeline task, that is fine, but I can't get that to work either.

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          You don't need copyartifact build parameters at all.

          Just configure:

          • Which build: Latest successful build
          • Parameter filters: START_BUILD_NUMBER=${BUILD_NUMBER}

          Anyway, I'm not sure you will successfully copy artifacts as your downstream builds run asynchronous.
          I recommend you to run builds in the blocking mode.

          Show
          ikedam ikedam added a comment - You don't need copyartifact build parameters at all. Just configure: Which build: Latest successful build Parameter filters: START_BUILD_NUMBER=${BUILD_NUMBER} Anyway, I'm not sure you will successfully copy artifacts as your downstream builds run asynchronous. I recommend you to run builds in the blocking mode.

            People

            Assignee:
            czmola Carl Zmola
            Reporter:
            czmola Carl Zmola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: