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

Env-inject plugin fails to inject BUILD_NUMBER parameter if => int32


      Steps to reproduce:
      1. Add string parameter BUILD_NUMBER
      2. Inject environment variables to the build process
          Evaluated Groovy script - Add something doesn't matter what print or
          def map = [:]

      3. Trigger build with BUILD_NUMBER=2147483648

      [EnvInject] - Executing scripts and injecting environment variables after the SCM step.
      [EnvInject] - Evaluating the Groovy script content
      [EnvInject] - [ERROR] - Problems occurs on injecting env vars defined in the build wrapper: java.lang.NumberFormatException: For input string: "2147483648". See system log for more info
      Notifying upstream projects of job completion
      Finished: FAILURE
      Problems occurs on injecting env vars defined in the build wrapper for build test/master #45
      java.lang.NumberFormatException: For input string: "2147483648"
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.lang.Integer.parseInt(Integer.java:587)
      	at java.lang.Integer.parseInt(Integer.java:615)
      	at org.jenkinsci.plugins.envinject.service.EnvInjectEnvVars.executeGroovyScript(EnvInjectEnvVars.java:217)
      	at org.jenkinsci.plugins.envinject.EnvInjectBuildWrapper.setUp(EnvInjectBuildWrapper.java:100)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:157)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      	at hudson.model.Run.execute(Run.java:1724)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:421)

      Remove Inject environment variables to the build process step
      Re-trigger build
      result - SUCCESS

      This affects only BUILD_NUMBER it is working as expected with BUILD_ID or any other parameter i tested.

            ww Wojciech Wojdanowski
            fstefanov Filip Stefanov
            0 Vote for this issue
            3 Start watching this issue