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

Pipeline: Warnings Plugin fails with CodeNarc XML report (java.io.NotSerializableException)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • CodeNarc - 0.27.0, 1.0
      Gradle - 2.3
      Warnings plugin - 4.56, 4.57
      Violations plugin - 0.7.11

      I run Codenarc with Gradle task into pipeline. Here is a part of build.gradle:

      codenarc {
          toolVersion = '0.27.0'
          reportFormat = 'xml'
          configFile = file('pathToRules.groovy')
          reportsDir = file('pathToReport')
      
      }
      
      codenarcMain {
          ignoreFailures = true
          sourceSets {
              main {
                  groovy {
                      srcDirs = [rootDir]
                  }
              }
          }
      }
      

      An analysis ends successfully, but when I try to parse it with Warnings plugin I get this exception:
       

      java.io.NotSerializableException: hudson.plugins.violations.types.codenarc.CodenarcParser
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at java.util.ArrayList.writeObject(ArrayList.java:742)
      	at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at hudson.remoting.UserRequest._serialize(UserRequest.java:190)
      	at hudson.remoting.UserRequest.serialize(UserRequest.java:199)
      Caused: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@561d00c8
      	at hudson.remoting.UserRequest.serialize(UserRequest.java:201)
      	at hudson.remoting.UserRequest.<init>(UserRequest.java:64)
      	at hudson.remoting.Channel.call(Channel.java:828)
      	at hudson.FilePath.act(FilePath.java:985)
      Caused: java.io.IOException: remote file operation failed: path/path/path 
      at hudson.remoting.Channel@2869915e:lglbi109-ecs-devkit-1.0.0.0.23
      	at hudson.FilePath.act(FilePath.java:992)
      	at hudson.FilePath.act(FilePath.java:974)
      	at hudson.plugins.warnings.WarningsPublisher.parseFiles(WarningsPublisher.java:400)
      	at hudson.plugins.warnings.WarningsPublisher.perform(WarningsPublisher.java:298)
      	at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:68)
      	at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:295)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:78)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:65)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
      	at hudson.security.ACL.impersonate(ACL.java:260)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      

      Also I try start with @NonCPS , but it didn't give any results.

          [JENKINS-45930] Pipeline: Warnings Plugin fails with CodeNarc XML report (java.io.NotSerializableException)

          Matej Kenda added a comment - - edited

          I get the same problem with Codenarc 1.1 and Jenkins 2.112.

          This is the piece of the code to publish CodeNarc results:

          warnings( [
              canComputeNew: false,
              canResolveRelativePaths: false,
              parserConfigurations: [
                  [parserName: 'Codenarc', pattern: 'target/CodeNarc-Report.xml']
              ],
              useDeltaValues: true,
              useStableBuildAsReference: true
          ] )
          

          Shall a sample codenarc file also help?

          Matej Kenda added a comment - - edited I get the same problem with Codenarc 1.1 and Jenkins 2.112. This is the piece of the code to publish CodeNarc results: warnings( [ canComputeNew: false , canResolveRelativePaths: false , parserConfigurations: [ [parserName: 'Codenarc' , pattern: 'target/CodeNarc-Report.xml' ] ], useDeltaValues: true , useStableBuildAsReference: true ] ) Shall a sample codenarc file also help?

          Fedor Chemaskin added a comment - - edited

          Hi, matejk. We found a workaround - use freestyle job and run it on master. We talked about this on our local Jenkins meetup (sorry for self-promotion):
          https://speakerdeck.com/fedos86/jenkins-pipeline-dev-tools?slide=34

          Fedor Chemaskin added a comment - - edited Hi,  matejk . We found a workaround - use freestyle job and run it on master. We talked about this on our local Jenkins meetup (sorry for self-promotion ): https://speakerdeck.com/fedos86/jenkins-pipeline-dev-tools?slide=34

          Matej Kenda added a comment - - edited

          Hi fch, thank you for your attention.

          We used CodeNarc plugin in a freestyle job, however we needed to convert it to a pipeline job and then CodeNarc plugin stopped to work. For now we just save the reports as artifacts.

          I'll try your suggestion, thanks,

          Matej Kenda added a comment - - edited Hi fch , thank you for your attention. We used CodeNarc plugin in a freestyle job, however we needed to convert it to a pipeline job and then CodeNarc plugin stopped to work. For now we just save the reports as artifacts. I'll try your suggestion, thanks,

          I had the same problem and created a pull request to fix it:

          https://github.com/jenkinsci/violations-plugin/pull/96

          roel postelmans added a comment - I had the same problem and created a pull request to fix it: https://github.com/jenkinsci/violations-plugin/pull/96

          Ulli Hafner added a comment -

          Fixed in new warnings next generation plugin.

          Ulli Hafner added a comment - Fixed in new warnings next generation plugin.

          drulli: Are there any plans for the first release of warnings-ng already? Will the codenarc parser be included there or will it still depend on the violations plugin?

          Joerg Schwaerzler added a comment - drulli : Are there any plans for the first release of warnings-ng already? Will the codenarc parser be included there or will it still depend on the violations plugin?

          Ulli Hafner added a comment -

          Well, there are beta releases available in the experimental update center for quite some time now. The new plugin has no dependency to violations plugin anymore, all parsers are supported natively. The 1.0 release will be ready in Dezember.

          Ulli Hafner added a comment - Well, there are beta releases available in the experimental update center for quite some time now. The new plugin has no dependency to violations plugin anymore, all parsers are supported natively. The 1.0 release will be ready in Dezember.

          drulli: Thanks for the quick answer. Sounds great

          Joerg Schwaerzler added a comment - drulli : Thanks for the quick answer. Sounds great

            Unassigned Unassigned
            fch Fedor Chemaskin
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: