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

injecting groovy Env variables - Exception not shown

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.609, EnvInject 1.92.1
    • Similar Issues:

      Description

      Whenever an exception comes up using *.groovy code to "inject environment variables to the build process", the exception and it´s message/stacktrace is not shown in the console / log:

      Only this line can be seen:

      [EnvInject] - [ERROR] - [EnvInject] - [ERROR] - Problems occurs on injecting env vars as a build wrap: null
      

      The code to reproduce this looks for example just like:

      def map = [ myKey: "myValue" ]
      
      // Exceptiion will NOT be reported
      map.createException()
      
      return map
      

      See also the attached file for a sample job.

      Please report the exception, so analyzing the problem would be much easier.

        Attachments

        1. config.xml
          2 kB
          Torsten Reinhard

          Issue Links

            Activity

            Hide
            sbrett9 Brett Sulprizio added a comment -

            Hoping this one gets solved soon.
            It is a extremely tedious process, debugging script that shows no errors, not even exception handling.

            I have need to inject Env Vars in order to use them as macros with the Build Name Setter plugin.
            I have to perform the SCM get, then parse a well known file that maintains the major and minor version number, retrieve those numbers using groovy and set the build description to show the software version that was built.

            During the writing of such a script in groovy, which took me 3 days of arduous trial and error, not being able to differentiate between syntax errors or logic errors during testing of the script was terribly frustrating.

            Show
            sbrett9 Brett Sulprizio added a comment - Hoping this one gets solved soon. It is a extremely tedious process, debugging script that shows no errors, not even exception handling. I have need to inject Env Vars in order to use them as macros with the Build Name Setter plugin. I have to perform the SCM get, then parse a well known file that maintains the major and minor version number, retrieve those numbers using groovy and set the build description to show the software version that was built. During the writing of such a script in groovy, which took me 3 days of arduous trial and error, not being able to differentiate between syntax errors or logic errors during testing of the script was terribly frustrating.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Yes, diagnostics needs to be improved.
            Created https://github.com/jenkinsci/envinject-plugin/pull/105

            Show
            oleg_nenashev Oleg Nenashev added a comment - Yes, diagnostics needs to be improved. Created https://github.com/jenkinsci/envinject-plugin/pull/105
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            src/main/java/org/jenkinsci/plugins/envinject/EnvInjectBuildWrapper.java
            http://jenkins-ci.org/commit/envinject-plugin/a8989123b6fa9f036a70998894b4f626aee02856
            Log:
            JENKINS-36237 - Improve diagnostics of issues in EnvInjectBuildWrapper (#105)

            Now EnvInjectBuildWrapper#setUp() provides more info in the build log and also forwards stacktrace to the system log.
            In addition, we rethrow Errors since we cannot recover from them

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/org/jenkinsci/plugins/envinject/EnvInjectBuildWrapper.java http://jenkins-ci.org/commit/envinject-plugin/a8989123b6fa9f036a70998894b4f626aee02856 Log: JENKINS-36237 - Improve diagnostics of issues in EnvInjectBuildWrapper (#105) Now EnvInjectBuildWrapper#setUp() provides more info in the build log and also forwards stacktrace to the system log. In addition, we rethrow Errors since we cannot recover from them
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            It has been released about 1 year ago

            Show
            oleg_nenashev Oleg Nenashev added a comment - It has been released about 1 year ago

              People

              • Assignee:
                oleg_nenashev Oleg Nenashev
                Reporter:
                torstenreinhard Torsten Reinhard
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: