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

Clover plugin still has problems with pipeline builds

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • clover-plugin
    • None

      After noting in JENKINS-27302 that version 4.6.0 of the clover plugin supports pipeline builds, I tried setting it up on a test job using a custom step as documented:

          step([$class: 'CloverPublisher', cloverReportDir: 'build/tests/coverage', cloverReportFileName: 'clover.xml'])
      

      This appears to work and puts a clover test result section in the results for an individual build, but after 2 builds it still doesn't display a coverage graph in the main Status page for the job.

      I tried restarting Jenkins, and got the following stack trace:

      WARNING: failed to load hudson.plugins.clover.CloverBuildAction@33885e1d from /var/lib/jenkins/jobs/plonk/builds/13/build.xml
      java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild
      	at hudson.plugins.clover.CloverBuildAction.onLoad(CloverBuildAction.java:156)
      	at hudson.model.Run.onLoad(Run.java:346)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:462)
      	at hudson.model.RunMap.retrieve(RunMap.java:224)
      	at hudson.model.RunMap.retrieve(RunMap.java:56)
      	at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:479)
      	at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:461)
      	at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:367)
      	at jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:332)
      	at jenkins.model.lazy.LazyBuildMixIn$RunMixIn.getPreviousBuild(LazyBuildMixIn.java:355)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:178)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:109)
      	at hudson.model.Job.getBuildStabilityHealthReport(Job.java:1169)
      	at hudson.model.Job.getBuildHealthReports(Job.java:1129)
      

      After this, clover stats don't display anywhere in the build, including the individual build status page. The only way I could fix the startup error is to delete all the build histories that had clover info in them.

      I'm not sure if the stack trace and failure to display the graph are actually the same problem.

          [JENKINS-34439] Clover plugin still has problems with pipeline builds

          sweetchuck markcariddi We have seen this issue on my project. It turned out to be a missing config for the clover publisher. Specifically the <failingTarget> config. This config's absence is not handled properly in the plugin, I opened an issue here: https://issues.jenkins-ci.org/browse/JENKINS-40297

          <hudson.plugins.clover.CloverPublisher>
          <cloverReportDir>target/site/clover</cloverReportDir>
          <cloverReportFileName>clover.xml</cloverReportFileName>
          <healthyTarget>
          <methodCoverage>70</methodCoverage>
          <conditionalCoverage>80</conditionalCoverage>
          <statementCoverage>80</statementCoverage>
          </healthyTarget>
          <unhealthyTarget>
          <methodCoverage>40</methodCoverage>
          <conditionalCoverage>40</conditionalCoverage>
          <statementCoverage>40</statementCoverage>
          </unhealthyTarget>
          <failingTarget>
          <methodCoverage>0</methodCoverage>
          <conditionalCoverage>0</conditionalCoverage>
          <statementCoverage>0</statementCoverage>
          </failingTarget>
          </hudson.plugins.clover.CloverPublisher>

          Ahmed Musallam added a comment - sweetchuck markcariddi We have seen this issue on my project. It turned out to be a missing config for the clover publisher. Specifically the <failingTarget> config. This config's absence is not handled properly in the plugin, I opened an issue here: https://issues.jenkins-ci.org/browse/JENKINS-40297 <hudson.plugins.clover.CloverPublisher> <cloverReportDir>target/site/clover</cloverReportDir> <cloverReportFileName>clover.xml</cloverReportFileName> <healthyTarget> <methodCoverage>70</methodCoverage> <conditionalCoverage>80</conditionalCoverage> <statementCoverage>80</statementCoverage> </healthyTarget> <unhealthyTarget> <methodCoverage>40</methodCoverage> <conditionalCoverage>40</conditionalCoverage> <statementCoverage>40</statementCoverage> </unhealthyTarget> <failingTarget> <methodCoverage>0</methodCoverage> <conditionalCoverage>0</conditionalCoverage> <statementCoverage>0</statementCoverage> </failingTarget> </hudson.plugins.clover.CloverPublisher>

          Can you confirm that this still happens in the latest Jenkins Clover Plugin - version 4.7.1?

          I'm asking because in this version I fixed NPE and closed two other tickets: JENKINS-38956 and JENKINS-39410 which look very similar to yours.

          I suspect that this bug report can be closed too.

          Marek Parfianowicz added a comment - Can you confirm that this still happens in the latest Jenkins Clover Plugin - version 4.7.1 ? I'm asking because in this version I fixed NPE and closed two other tickets: JENKINS-38956  and JENKINS-39410  which look very similar to yours. I suspect that this bug report can be closed too.

          Matias Montes added a comment -

          I can confirm that in 4.7.1 still there is no coverage graph in the main Status page for the job.

           

           

          Matias Montes added a comment - I can confirm that in 4.7.1 still there is no coverage graph in the main Status page for the job.    

          Code changed in jenkins
          User: Piotr Mis
          Path:
          src/main/java/hudson/plugins/clover/CloverBuildAction.java
          src/main/java/hudson/plugins/clover/CloverProjectAction.java
          src/main/java/hudson/plugins/clover/CloverPublisher.java
          http://jenkins-ci.org/commit/clover-plugin/a58061c681f24c6262fd7c07088f002b48fe5b49
          Log:
          JENKINS-34439 Clover plugin still has problems with pipeline builds

          Clover action not displayed on workflow job main page.

          CloverBuildAction.java

          • Added SimpleBuildStep.LastBuildAction interface
          • changed AbstractBuild to Run<?,?>

          CloverProjectAction.java

          • changed Project to Job
          • changed Build to Run

          CloverPublisher.java

          • removed not needed imports
          • removed getProjectAction (moved to BuildAction)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Piotr Mis Path: src/main/java/hudson/plugins/clover/CloverBuildAction.java src/main/java/hudson/plugins/clover/CloverProjectAction.java src/main/java/hudson/plugins/clover/CloverPublisher.java http://jenkins-ci.org/commit/clover-plugin/a58061c681f24c6262fd7c07088f002b48fe5b49 Log: JENKINS-34439 Clover plugin still has problems with pipeline builds Clover action not displayed on workflow job main page. CloverBuildAction.java Added SimpleBuildStep.LastBuildAction interface changed AbstractBuild to Run<?,?> CloverProjectAction.java changed Project to Job changed Build to Run CloverPublisher.java removed not needed imports removed getProjectAction (moved to BuildAction)

          Code changed in jenkins
          User: Piotr Mis
          Path:
          src/test/java/hudson/plugins/clover/CloverBuildActionTest.java
          http://jenkins-ci.org/commit/clover-plugin/18ee1071bc3c3ffc64d6ea0f9c3144c84e04bf03
          Log:
          JENKINS-34439 Clover plugin still has problems with pipeline builds

          Clover action not displayed on workflow job main page.

          CloverBuildActionTest.java

          • Test extended with checking if CloverProjectAction is added properly to Job

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Piotr Mis Path: src/test/java/hudson/plugins/clover/CloverBuildActionTest.java http://jenkins-ci.org/commit/clover-plugin/18ee1071bc3c3ffc64d6ea0f9c3144c84e04bf03 Log: JENKINS-34439 Clover plugin still has problems with pipeline builds Clover action not displayed on workflow job main page. CloverBuildActionTest.java Test extended with checking if CloverProjectAction is added properly to Job

          Code changed in jenkins
          User: Piotr Mis
          Path:
          src/main/java/hudson/plugins/clover/CloverBuildAction.java
          http://jenkins-ci.org/commit/clover-plugin/02b183882a96d62e25c319ae1ca56b052c5faf24
          Log:
          JENKINS-34439 Clover plugin still has problems with pipeline builds

          CloverBuildAction.java:

          • Refactored this.projectAction access

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Piotr Mis Path: src/main/java/hudson/plugins/clover/CloverBuildAction.java http://jenkins-ci.org/commit/clover-plugin/02b183882a96d62e25c319ae1ca56b052c5faf24 Log: JENKINS-34439 Clover plugin still has problems with pipeline builds CloverBuildAction.java: Refactored this.projectAction access

          Code changed in jenkins
          User: Marek Parfianowicz
          Path:
          src/main/java/hudson/plugins/clover/CloverBuildAction.java
          src/main/java/hudson/plugins/clover/CloverProjectAction.java
          src/main/java/hudson/plugins/clover/CloverPublisher.java
          src/test/java/hudson/plugins/clover/CloverBuildActionTest.java
          http://jenkins-ci.org/commit/clover-plugin/8f4be30f572caa7a5b3fca1fe94e83702ac4829e
          Log:
          Merge pull request #20 from piomis/JENKINS-34439_no_trend_graph_on_main_job_page

          JENKINS-34439 Clover plugin still has problems with pipeline builds

          Compare: https://github.com/jenkinsci/clover-plugin/compare/53acf8b28fe0...8f4be30f572c

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marek Parfianowicz Path: src/main/java/hudson/plugins/clover/CloverBuildAction.java src/main/java/hudson/plugins/clover/CloverProjectAction.java src/main/java/hudson/plugins/clover/CloverPublisher.java src/test/java/hudson/plugins/clover/CloverBuildActionTest.java http://jenkins-ci.org/commit/clover-plugin/8f4be30f572caa7a5b3fca1fe94e83702ac4829e Log: Merge pull request #20 from piomis/ JENKINS-34439 _no_trend_graph_on_main_job_page JENKINS-34439 Clover plugin still has problems with pipeline builds Compare: https://github.com/jenkinsci/clover-plugin/compare/53acf8b28fe0...8f4be30f572c

          Marek Parfianowicz added a comment - - edited

          I tested the plugin with the changes from the pull request #20 and it seems that on a single master node the plugin works fine - I saw the graph after two builds, I didn't find 'WorkflowRun cannot be cast to AbstractBuild' exception too.

          When testing clover with slaves, the problem with

          java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper

          still persists. I'm working on it - this issue is tracked in JENKINS-33610.

          Marek Parfianowicz added a comment - - edited I tested the plugin with the changes from the pull request #20 and it seems that on a single master node the plugin works fine - I saw the graph after two builds, I didn't find 'WorkflowRun cannot be cast to AbstractBuild' exception too. When testing clover with slaves, the problem with java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper still persists. I'm working on it - this issue is tracked in JENKINS-33610 .

          Code changed in jenkins
          User: Marek Parfianowicz
          Path:
          pom.xml
          http://jenkins-ci.org/commit/clover-plugin/56d2d2c6ec11d26e6fd929d15bb2dfbf9dbcfe71
          Log:
          JENKINS-34439: upgrade Workflow plugin to 2.0 (when it was renamed to the Pipeline Plugin); bumped minimum Jenkins version to 1.642.3 (the same minimum required by the Pipelines plugin, according to usage statistics over 95% instances with Clover run on 1.642.3 or higher so it should be fine)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marek Parfianowicz Path: pom.xml http://jenkins-ci.org/commit/clover-plugin/56d2d2c6ec11d26e6fd929d15bb2dfbf9dbcfe71 Log: JENKINS-34439 : upgrade Workflow plugin to 2.0 (when it was renamed to the Pipeline Plugin); bumped minimum Jenkins version to 1.642.3 (the same minimum required by the Pipelines plugin, according to usage statistics over 95% instances with Clover run on 1.642.3 or higher so it should be fine)

          Fix will be delivered in 4.8.1+

          Marek Parfianowicz added a comment - Fix will be delivered in 4.8.1+

            marekparf Marek Parfianowicz
            toadnik17 Todd Perry
            Votes:
            15 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: