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

not copying artfacts from another job using specifc build number passed by environment variable.

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      copy artifacts-1.24 Jenkins LTS-1.447.2 at ubuntu LTS 10.04 master and slave
    • Similar Issues:

      Description

      Injecting environment variable via envinject plugin which is sucessfull, later failed while using that variable in copy artifact plugin.

      find stracktrace below:

      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties content
      DOWNSTREAM_JOB_BUILD_NUMBER1=$DOWNSTREAM_JOB_BUILD_NUMBER

      [EnvInject] - Variables injected successfully.
      FATAL: For input string: "$DOWNSTREAM_JOB_BUILD_NUMBER"
      java.lang.NumberFormatException: For input string: "$DOWNSTREAM_JOB_BUILD_NUMBER"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
      at java.lang.Integer.parseInt(Integer.java:449)
      at java.lang.Integer.parseInt(Integer.java:499)
      at hudson.plugins.copyartifact.SpecificBuildSelector.getBuild(SpecificBuildSelector.java:51)
      at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:176)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:697)
      at hudson.model.Build$RunnerImpl.build(Build.java:178)
      at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:467)
      at hudson.model.Run.run(Run.java:1404)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)

        Attachments

          Activity

          Hide
          hiteswar_kumar hiteswar kumar added a comment -

          Hi ,
          Can anyone update how we can use any environment variable as buildnumber of another job to copy artifacts b.

          Show
          hiteswar_kumar hiteswar kumar added a comment - Hi , Can anyone update how we can use any environment variable as buildnumber of another job to copy artifacts b.
          Hide
          almorelle Alexis Morelle added a comment -

          You can pass it as a job parameter. For example you'd have a String parameter for the job named "BUILD_NUMBER" and in the specific build number field you reuse that with "$BUILD_NUMBER".

          Varaibles are expanded so I don't see why it wouldn't work with envinject. From what I see, inject a variable named "DOWNSTREAM_JOB_BUILD_NUMBER1" and affect it with "$DOWNSTREAM_JOB_BUILD_NUMBER".

          [EnvInject] - Injecting as environment variables the properties content
          DOWNSTREAM_JOB_BUILD_NUMBER1=$DOWNSTREAM_JOB_BUILD_NUMBER

          So the variable can be expanded in "$DOWNSTREAM_JOB_BUILD_NUMBER1" which is not a build number. Moreover, if you only injected this, there's no "$DOWNSTREAM_JOB_BUILD_NUMBER" variable.

          Show
          almorelle Alexis Morelle added a comment - You can pass it as a job parameter. For example you'd have a String parameter for the job named "BUILD_NUMBER" and in the specific build number field you reuse that with "$BUILD_NUMBER". Varaibles are expanded so I don't see why it wouldn't work with envinject. From what I see, inject a variable named "DOWNSTREAM_JOB_BUILD_NUMBER1" and affect it with "$DOWNSTREAM_JOB_BUILD_NUMBER". [EnvInject] - Injecting as environment variables the properties content DOWNSTREAM_JOB_BUILD_NUMBER1=$DOWNSTREAM_JOB_BUILD_NUMBER So the variable can be expanded in "$DOWNSTREAM_JOB_BUILD_NUMBER1" which is not a build number. Moreover, if you only injected this, there's no "$DOWNSTREAM_JOB_BUILD_NUMBER" variable.

            People

            • Assignee:
              Unassigned
              Reporter:
              hiteswar_kumar hiteswar kumar
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: