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

Warning with JunitPublisher now fails the build

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • pipeline-maven-plugin
    • None
    • Jenkins LTS 2.426.2

      We recently upgraded to the latest Jenkins LTS version and updated all plugins, including the withMaven plugin, which is causing us issues now.
       
      We have the following configuration in the pipeline:
       
      withMaven(
      maven: "maven-3.6.3",
      jdk: "jdk14",
      mavenSettingsFilePath: "${MAVEN_SETTINGS_XML}",
      mavenLocalRepo: ".repository",
      publisherStrategy: "EXPLICIT",
      options: [
      junitPublisher(disabled: false)
      ]
      )

      { ... }

       
      Previously, after the normal build, withMaven proceeds with the publishers, e.g.:
       
      [withMaven] junitPublisher - Archive test results for Maven artifact dk.lsb.backend-api.infrastructure-modules.operations:operations-component:jar:1.00-SNAPSHOT generated by maven-surefire-plugin:test (default-test): infrastructure-modules\operations\component\target\surefire-reports/*.xml
      [withMaven] junitPublisher - Archive test results for Maven artifact dk.lsb.backend-api.infrastructure-modules.operations:operations-war:war:1.00-SNAPSHOT generated by maven-surefire-plugin:test (default-test): infrastructure-modules\operations\war\target\surefire-reports/*.xml
      [withMaven] junitPublisher - Jenkins JUnit Flaky Test Handler Plugin not found, can't publish JUnit flaky tests reports.
      Recording test results
      ERROR: [withMaven] WARNING Exception executing Maven reporter 'Junit Publisher' / org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher. Please report a bug associated for the component 'pipeline-maven-plugin' at https://issues.jenkins-ci.org 
      java.lang.IllegalArgumentException: Cannot relativize 'target/surefire-reports' relatively to 'e:/build/backend/develop'
      at org.jenkinsci.plugins.pipeline.maven.util.XmlUtils.getPathInWorkspace(XmlUtils.java:365)
      at org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.executeReporter(JunitTestsPublisher.java:269)
      at org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.process(JunitTestsPublisher.java:215)
      at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:153)
      at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2$WithMavenStepExecutionCallBack.finished(WithMavenStepExecution2.java:1102)
      at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution$TailCall.lambda$onSuccess$0(GeneralNonBlockingStepExecution.java:140)
      at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      at java.base/java.lang.Thread.run(Thread.java:1583)
      [withMaven] Publishers: Junit Publisher: 133 ms
       
      This error has been with us for a long time and has always just been reported as the above warning and the build proceeded. This worked up till withMaven version 1161.v89a_7dcec5d31
       
      With the latest withMaven version 1368.vfb_8509d7b_869, the log outputs:
       
      [withMaven] junitPublisher - Archive test results for Maven artifact dk.lsb.backend-api.infrastructure-modules.operations:operations-component:jar:1.00-SNAPSHOT generated by maven-surefire-plugin:test (default-test): infrastructure-modules\operations\component\target\surefire-reports/*.xml
      [withMaven] junitPublisher - Archive test results for Maven artifact dk.lsb.backend-api.infrastructure-modules.operations:operations-war:war:1.00-SNAPSHOT generated by maven-surefire-plugin:test (default-test): infrastructure-modules\operations\war\target\surefire-reports/*.xml
      [withMaven] junitPublisher - Jenkins JUnit Flaky Test Handler Plugin not found, can't publish JUnit flaky tests reports.
      Recording test results
      [Checks API] No suitable checks publisher found.
      ERROR: [withMaven] WARNING Exception executing Maven reporter 'Junit Publisher' / org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher. Please report a bug associated for the component 'pipeline-maven-plugin' at https://issues.jenkins-ci.org 
      java.lang.IllegalArgumentException: Cannot relativize 'target/surefire-reports' relatively to 'e:/build/backend/develop/workspace'
      at org.jenkinsci.plugins.pipeline.maven.util.XmlUtils.getPathInWorkspace(XmlUtils.java:381)
      at org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.executeReporter(JunitTestsPublisher.java:302)
      at org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.process(JunitTestsPublisher.java:218)
      at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:172)
      at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2$WithMavenStepExecutionCallBack.finished(WithMavenStepExecution2.java:1303)
      at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution$TailCall.lambda$onSuccess$0(GeneralNonBlockingStepExecution.java:140)
      at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      at java.base/java.lang.Thread.run(Thread.java:1583)
      [withMaven] Publishers: Junit Publisher: 36 ms
       
      But differs from the previous version, by failing the entire build!
       
      Can you revert to the previous behaviour, where the build continues, instead og failing the entire build?
       

          [JENKINS-72484] Warning with JunitPublisher now fails the build

          pete added a comment -

          If there's no plan to revert back to previous behavior, how can we fix the error "java.lang.IllegalArgumentException: Cannot relativize 'some_path' relatively to 'another_path'" ?

          some_path == path where Junit tests are.

          another_path == path where main pom.xml is to build the whole project.

          another_path will not be the start of some_path since they are under different folders.

          https://github.com/jenkinsci/pipeline-maven-plugin/blob/1376.v18876d10ce9c/pipeline-maven/src/main/java/org/jenkinsci/plugins/pipeline/maven/util/XmlUtils.java#L361 

          pete added a comment - If there's no plan to revert back to previous behavior, how can we fix the error "java.lang.IllegalArgumentException: Cannot relativize ' some_path ' relatively to ' another_path '" ? some_path == path where Junit tests are. another_path == path where main pom.xml is to build the whole project. another_path will not be the start of some_path since they are under different folders. https://github.com/jenkinsci/pipeline-maven-plugin/blob/1376.v18876d10ce9c/pipeline-maven/src/main/java/org/jenkinsci/plugins/pipeline/maven/util/XmlUtils.java#L361  

            Unassigned Unassigned
            erik_reuter Erik
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: