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

post groovy script throws Null Exception

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: build-flow-plugin
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      I am using the build flow project for combining the two different project test results.Then i am in need to change the build status of the aggregated test results so i am using groovy postbuild to change my build status.In that script if any one of the test fails gets failed in any of the projects then i am trying to change the build status to unstable.For that i am calculating the fail counts from both results using groovy script.But when i am trying this it throws the NULL pointer Exception.
      The script i used in the groovy postbuild is

      def testResult = manager.build.testResultAction.result
      def fail = testResult.failCount
      if(fail==NULL)

      { manager.buildSuccess() }

      else

      { manager.buildUnstable() }

      It throws the exception as
      ava.lang.NullPointerException: Cannot get property 'result' on null object
      at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56)
      at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156)
      at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
      at Script1.run(Script1.groovy:1)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:166)
      at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:362)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
      at hudson.model.Build$BuildExecution.post2(Build.java:185)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
      at hudson.model.Run.execute(Run.java:1763)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:410)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gautham Gautham Rathina kumar
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: