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

Copy artifacts from all "Downstream build of"

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.593
      copyartifact 1.35
    • Similar Issues:

      Description

      The downstream build selector does not work with multiple downstream builds; only artifacts from the most recent downstream build are copied.
      I want to copy artifacts not only from the latest build, but from ALL downstream builds.

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          Could not reproduce that in my environment.
          Please report detailed steps to reproduce the problem.

          Steps I tested:

          1. Install Jenkins 1.593.
          2. Install Copyartifact 1.35.
          3. Create a freestype project "upstream"
            • Add "Execute Shell" in "Build"
              echo ${BUILD_ID} ${BUILD_NUMBER} > artifact_upstream.txt
              
            • Add "Archive the artifacts" in "Post-build Actions"
              • Files to archive: artifact_upstream.txt
              • Check "Fingerprint all archived artifacts" (Important!)
            • Add "Build other projects" in "Post-build Actions"
              • Project to build: downstream
                • Don't mind even if you will be warned that "No such project 'downstream'". You'll create that in followings.
          4. Create a freestype project "downstream"
            • Add "Copy artifacts from another project" in "Build"
              • Project name: upstream
              • Which build: Upstream build that triggered this job
              • Artifacts to copy: artifact.txt
              • Check "Fingerprint Artifacts" (Important!)
            • Add "Execute Shell" in "Build"
              echo ${BUILD_ID} ${BUILD_NUMBER} > artifact_downstream.txt
              
            • Add "Archive the artifacts" in "Post-build Actions"
              • Files to archive: artifact_downstream.txt
          5. Run builds of "upstream" twice.
            • Following relations are created:
              • "upstream #1" -> "downstream #1"
              • "upstream #2" -> "downstream #2"
            • Go to "See Fingerprints" of "upstream #1", "more details" of "artifact_upstram.txt" and see that "downstream #1" is listed there.
          6. Create a freestyle project "copier"
            • Add "Copy artifacts from another project" in "Build"
              • Project name: downstream
              • Which build: Downstream build of
                • Upstream Project Name: "upstream"
                • Upstream Build Number: 1
              • Artifacts to copy: artifact_downstream.txt
            • Add "Execute Shell" in "Build"
              cat artifact_downstream.txt
              
          7. Run a build of "copier"

          Result:

          • You will see a line like this in the log of "copier #1"
            2015-05-03_10-42-06 1
            
            • This means the build of "downstream" from which an artifact is copied (the time string will be changed in your environment). It copies from "downstream #1" as expected.
          Show
          ikedam ikedam added a comment - Could not reproduce that in my environment. Please report detailed steps to reproduce the problem. Steps I tested: Install Jenkins 1.593. Install Copyartifact 1.35. Create a freestype project "upstream" Add "Execute Shell" in "Build" echo ${BUILD_ID} ${BUILD_NUMBER} > artifact_upstream.txt Add "Archive the artifacts" in "Post-build Actions" Files to archive: artifact_upstream.txt Check "Fingerprint all archived artifacts" (Important!) Add "Build other projects" in "Post-build Actions" Project to build: downstream Don't mind even if you will be warned that "No such project 'downstream'". You'll create that in followings. Create a freestype project "downstream" Add "Copy artifacts from another project" in "Build" Project name: upstream Which build: Upstream build that triggered this job Artifacts to copy: artifact.txt Check "Fingerprint Artifacts" (Important!) Add "Execute Shell" in "Build" echo ${BUILD_ID} ${BUILD_NUMBER} > artifact_downstream.txt Add "Archive the artifacts" in "Post-build Actions" Files to archive: artifact_downstream.txt Run builds of "upstream" twice. Following relations are created: "upstream #1" -> "downstream #1" "upstream #2" -> "downstream #2" Go to "See Fingerprints" of "upstream #1", "more details" of "artifact_upstram.txt" and see that "downstream #1" is listed there. Create a freestyle project "copier" Add "Copy artifacts from another project" in "Build" Project name: downstream Which build: Downstream build of Upstream Project Name: "upstream" Upstream Build Number: 1 Artifacts to copy: artifact_downstream.txt Add "Execute Shell" in "Build" cat artifact_downstream.txt Run a build of "copier" Result: You will see a line like this in the log of "copier #1" 2015-05-03_10-42-06 1 This means the build of "downstream" from which an artifact is copied (the time string will be changed in your environment). It copies from "downstream #1" as expected.
          Hide
          simonmweber Simon Weber added a comment -

          Sorry, I was unclear. I'm referring to a situation in which the upstream build starts more than one of the same downstream build, all of which are linked by fingerprinting. From my understanding, you're referring to a situation in which the upstream only starts one downstream build (of which more than one have been triggered in the past).

          For example, imagine a situation in which you have one upstream build. It's purpose is to run tests in parallel. To do this, it just runs 2 downstream builds that each run half of the test suite. All of these are linked by fingerprinting on, say, the upstream's BUILD_TAG. The bug I'm reporting it that attempting to copy artifacts inside upstream for "downstream build of (upstream, $BUILD_NUMBER)", artifacts are only copied from the downstream build with the highest build number. In this situation, I'd expect artifacts to be copied from all downstream builds.

          Let me know if you need more detailed reproduction instructions – I can get them to you tomorrow.

          Show
          simonmweber Simon Weber added a comment - Sorry, I was unclear. I'm referring to a situation in which the upstream build starts more than one of the same downstream build, all of which are linked by fingerprinting. From my understanding, you're referring to a situation in which the upstream only starts one downstream build (of which more than one have been triggered in the past). For example, imagine a situation in which you have one upstream build. It's purpose is to run tests in parallel. To do this, it just runs 2 downstream builds that each run half of the test suite. All of these are linked by fingerprinting on, say, the upstream's BUILD_TAG. The bug I'm reporting it that attempting to copy artifacts inside upstream for "downstream build of (upstream, $BUILD_NUMBER)", artifacts are only copied from the downstream build with the highest build number. In this situation, I'd expect artifacts to be copied from all downstream builds. Let me know if you need more detailed reproduction instructions – I can get them to you tomorrow.
          Hide
          ikedam ikedam added a comment -

          I got it.
          No need for detailed instructions. Thanks.

          Unfortunately, copyartifact doesn't provide the way to copy artifacts from multiple builds that suffices a condition.
          I updated the issue type from "Bug" to "Improvement".

          Show
          ikedam ikedam added a comment - I got it. No need for detailed instructions. Thanks. Unfortunately, copyartifact doesn't provide the way to copy artifacts from multiple builds that suffices a condition. I updated the issue type from "Bug" to "Improvement".
          Hide
          thargreaves_rhi Tim Hargreaves added a comment -

          I have a similar situation where I am attempting to generate asset bundles for two different platforms. Rather than have a separate job for each platform, I want to use a single job that takes the platform as a parameter.

          The workaround I'm using right now is to run one instance of the job, run copy artifact, run the second instance, run copy artifact again, and then stitch the results together in the upstream job.

          Unfortunately, this means I cannot run the asset bundle jobs in parallel which makes it take much longer.

          Show
          thargreaves_rhi Tim Hargreaves added a comment - I have a similar situation where I am attempting to generate asset bundles for two different platforms. Rather than have a separate job for each platform, I want to use a single job that takes the platform as a parameter. The workaround I'm using right now is to run one instance of the job, run copy artifact, run the second instance, run copy artifact again, and then stitch the results together in the upstream job. Unfortunately, this means I cannot run the asset bundle jobs in parallel which makes it take much longer.
          Hide
          simonmweber Simon Weber added a comment -

          In case it helps, here's a script I've been using to work around this: https://gist.github.com/simon-weber/35f5d27a21ebf9b8ad8e.

          Show
          simonmweber Simon Weber added a comment - In case it helps, here's a script I've been using to work around this: https://gist.github.com/simon-weber/35f5d27a21ebf9b8ad8e .

            People

            • Assignee:
              Unassigned
              Reporter:
              simonmweber Simon Weber
            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: