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

[cygwin] JunitPublisher fails to convert Spy log paths into paths relative to the workspace

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • cygwin
      Jenkins 2.86
      pipeline-maven-plugin 3.0.2

      We are running a Jenkins master under Linux and a Windows slave under Cygwin.

      The JunitTestPublisher fails at the end of the maven build with the following error:

      java.lang.IllegalArgumentException: Cannot relativize 'D:\home\builder\workspace\aven-single-pipeline_master-JBUUVCDBFMEQBMT26UI5UGSR4QCXX6Y4IUDOLCM3AQQM3XS2TLNQ\target/surefire-reports' relatively to '/home/builder/workspace/aven-single-pipeline_master-JBUUVCDBFMEQBMT26UI5UGSR4QCXX6Y4IUDOLCM3AQQM3XS2TLNQ'
       	at org.jenkinsci.plugins.pipeline.maven.util.XmlUtils.getPathInWorkspace(XmlUtils.java:319)
       	at org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.executeReporter(JunitTestsPublisher.java:235)
       	at org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.process(JunitTestsPublisher.java:181)

       

      As you noticed, paths extracted from the maven execution by the Spy plugin are in the Windows format, whereas the workspace path as reported by Jenkins is in standard Unix format.

      The plugin is unable to compute a path relative to the workspace because the two arguments are in different format.

          [JENKINS-47704] [cygwin] JunitPublisher fails to convert Spy log paths into paths relative to the workspace

          Wouldn't be easier to ask the maven plugin to report its paths relative to the workspace? The workspace location could be passed as argument and the plugin would normalize it (windows/unix format) in a way compatible to how it reports the other paths/filenames ?

           

          Bertrand Renuart added a comment - Wouldn't be easier to ask the maven plugin to report its paths relative to the workspace? The workspace location could be passed as argument and the plugin would normalize it (windows/unix format) in a way compatible to how it reports the other paths/filenames ?  

          > Wouldn't be easier to ask the maven plugin to report its paths relative to the workspace?

          Maven is not really aware that it's running in the context of a Jenkins build. I would like to do it the other way round.

          I would like to verify that a Jenkins agent, even launched with Cygwin, returns a "file.getCanonicalPath()" that matches with the path generated in the Maven Event Spy

          https://github.com/jenkinsci/pipeline-maven-plugin/blob/pipeline-maven-3.0.2/maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/AbstractMavenEventHandler.java#L99

          Cyrille Le Clerc added a comment - > Wouldn't be easier to ask the maven plugin to report its paths relative to the workspace? Maven is not really aware that it's running in the context of a Jenkins build. I would like to do it the other way round. I would like to verify that a Jenkins agent, even launched with Cygwin, returns a "file.getCanonicalPath()" that matches with the path generated in the Maven Event Spy https://github.com/jenkinsci/pipeline-maven-plugin/blob/pipeline-maven-3.0.2/maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/AbstractMavenEventHandler.java#L99

            Unassigned Unassigned
            brenuart Bertrand Renuart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: