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

Mix of Win-style and Linux-style file path separators used in pipeline script run from docker image jenkins/jenkins:jdk11

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm running a Jenkins pipeline job from a docker container originating from dockerhub image jenkins/jenkins:jdk11. The container is executed on a Win10 host using the most recent Win docker desktop.

      The job fails with error message:

      }}{{
      {{[INFO] }}
      [INFO] -------------------------------------------------------
      [INFO] T E S T S
      [INFO] -------------------------------------------------------
      [INFO] Running TestSuite
      java.io.FileNotFoundException: /var/jenkins_home/workspace/Quarkus-Todo-TA-noBDD\src\main\resources\properties\object.properties (No such file or directory)
      {{ at java.base/java.io.FileInputStream.open0(Native Method)}}
      {{ at java.base/java.io.FileInputStream.open(FileInputStream.java:219)}}
      {{ at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)}}

      As can be seen, the error is caused by a mixed usage of Win-stype and Linux-stype file path separators. The issue doesn't arise in a native Win installation of Jenkins.

      This is the relevant part of the pipeline:

      pipeline {

      agent any

      stages{
      {{ stage('Clean workspace (mvn clean)') {}}
      {{ steps {}}
      {{ sh 'mvn -f pom.xml clean'}}
      {{ }}}
      {{ }}}
      {{ stage('Run TestNG tests and create deployment package (mvn package)') {}}
      {{ steps {}}
      {{ sh 'mvn -f pom.xml -Dexec.args=\"-reporter org.testng.reporters.XMLReporter:generateTestResultAttributes=true,generateGroupsAttribute=true -outputDirectory=FirstTestautomation/target/surefire-reports -useDefaultListeners false\" -Dmaven.test.failure.ignore=true compile install'}}
      {{ }}}
      {{ }}}

      ...

      Please find attached the full console output and the configuration of the dockered Jenkins.

      Is there a way to fix this?

      Kind regards

      – Frank Bergemann

        Attachments

          Activity

          Hide
          frank_bergemann Frank Bergemann added a comment -

          Hi Carlos Sanchez, I think that you are likely working on a voluntatry basis in the Jenkins project. I highly appreciate this but may I ask if you could have time to take a look at this issue? Kind regards – Frank

          Show
          frank_bergemann Frank Bergemann added a comment - Hi Carlos Sanchez , I think that you are likely working on a voluntatry basis in the Jenkins project. I highly appreciate this but may I ask if you could have time to take a look at this issue? Kind regards – Frank
          Hide
          frank_bergemann Frank Bergemann added a comment -

          This is actually not a Jenkins issue but caused by the Java code executed by my pipeline. The fix is easy by making file path separators appearing in the code OS-independent (well-documented in Java forums). Sorry for the inconvenience. – Frank

          Show
          frank_bergemann Frank Bergemann added a comment - This is actually not a Jenkins issue but caused by the Java code executed by my pipeline. The fix is easy by making file path separators appearing in the code OS-independent (well-documented in Java forums). Sorry for the inconvenience. – Frank

            People

            Assignee:
            csanchez Carlos Sanchez
            Reporter:
            frank_bergemann Frank Bergemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: