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

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • copyartifact-plugin
    • Jenkins 1.609.1 running inside Docker container
      Copy Artifact Plugin Version 1.35.2

      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.

          [JENKINS-29812] Need an Environment variable with multiple build numbers when copying multiple artifacts from different builds of the same project

          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.

          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.

          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.

          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.

          ikedam added a comment -

          nicolas_avenza
          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.

          ikedam added a comment - nicolas_avenza 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.

          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

          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

          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.

          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.

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

          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

          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.

          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.

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

              Created:
              Updated:
              Resolved: