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

Need an Environment variable with multiple build numbers when copying multiple artifacts from different builds of the same project

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: copyartifact-plugin
    • Labels:
    • Environment:
      Jenkins 1.609.1 running inside Docker container
      Copy Artifact Plugin Version 1.35.2
    • Similar Issues:

      Description

      The current strategy of COPYARTIFACT_BUILD_NUMBER_MYPROJNAME does not work when copying artifacts from two or more builds of the same project. The build number is overwritten by each artifact copy step.

      We're running tests on one project and then comparing two or more results of the same test by copying those artifacts. However it would be useful to have an environment variable with a list of all the build numbers that were accessed by the copy artifact step.

      Please see the Parameterized Trigger Plugin for an example of how this could be done. What they have is an environment variable that returns a comma separated list of build numbers.

        Attachments

          Issue Links

            Activity

            Hide
            ikedam ikedam added a comment -

            I plan to introduce a field to specify the variable name to store the build number for a fix of JENKINS-18938.
            I believe that also resolves this.

            Show
            ikedam ikedam added a comment - I plan to introduce a field to specify the variable name to store the build number for a fix of JENKINS-18938 . I believe that also resolves this.
            Hide
            nicolas_avenza nicolas di noia added a comment -

            That sounds like a reasonable solution.

            Will this field also be available when using a build parameter to specify the build selector? If it is then the variable should be set even before the copy artifacts build step occurs.

            Show
            nicolas_avenza nicolas di noia added a comment - That sounds like a reasonable solution. Will this field also be available when using a build parameter to specify the build selector? If it is then the variable should be set even before the copy artifacts build step occurs.
            Hide
            ikedam ikedam added a comment -

            nicolas di noia
            I couldn't get what you meant.
            You may describe more details.
            I plan to add a new filed just jike "Project name", "Artifacts to copy" and so on.

            Show
            ikedam ikedam added a comment - nicolas di noia I couldn't get what you meant. You may describe more details. I plan to add a new filed just jike "Project name", "Artifacts to copy" and so on.
            Hide
            nicolas_avenza nicolas di noia added a comment - - edited

            I understand that currently the COPYARTIFACT_BUILD_NUMBER_MYPROJNAME environment variable is only set after the copy artifact build step

            However I'm using a parameter to select which build and I was wondering if you could make the environment variable available from the start of the job if the build number has been set using the Build selector for Copy Artifact parameter.

            I want to use the Build Name Setter plugin to set the build name to something like #1: Artifacts from #100 vs Artifacts from #105

            Show
            nicolas_avenza nicolas di noia added a comment - - edited I understand that currently the COPYARTIFACT_BUILD_NUMBER_MYPROJNAME environment variable is only set after the copy artifact build step However I'm using a parameter to select which build and I was wondering if you could make the environment variable available from the start of the job if the build number has been set using the Build selector for Copy Artifact parameter. I want to use the Build Name Setter plugin to set the build name to something like #1: Artifacts from #100 vs Artifacts from #105
            Hide
            ikedam ikedam added a comment -

            I don't plan that feature.
            You already can use a variable for SpecificBuildParameter and your case should be satisfied with that.

            Show
            ikedam ikedam added a comment - I don't plan that feature. You already can use a variable for SpecificBuildParameter and your case should be satisfied with that.
            Hide
            nicolas_avenza nicolas di noia added a comment -

            That was an example. We also use Last Completed Build, Latest Saved Build, Upstream build that triggered this job, etc

            Show
            nicolas_avenza nicolas di noia added a comment - That was an example. We also use Last Completed Build , Latest Saved Build , Upstream build that triggered this job , etc
            Hide
            ikedam ikedam added a comment -

            Released 1.36, which allows you specify the suffix for the environment variable. You can use different variables for each copying.
            Please try that.

            Show
            ikedam ikedam added a comment - Released 1.36, which allows you specify the suffix for the environment variable. You can use different variables for each copying. Please try that.

              People

              • Assignee:
                ikedam ikedam
                Reporter:
                nicolas_avenza nicolas di noia
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: