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

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

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Activity

          oleg_nenashev Oleg Nenashev added a comment -

          I will be happy to review pull requests, should be a trivial fix

          oleg_nenashev Oleg Nenashev added a comment - I will be happy to review pull requests, should be a trivial fix

          Hi, is there any specific side effect that is expected when injecting BUILD_NUMBER?

          Here is a fix proposal:

          https://github.com/jenkinsci/envinject-plugin/pull/139

          ww Wojciech Wojdanowski added a comment - Hi, is there any specific side effect that is expected when injecting BUILD_NUMBER? Here is a fix proposal: https://github.com/jenkinsci/envinject-plugin/pull/139

          People

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

            Dates

              Created:
              Updated: