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

Secret File path not relative to workspace - noticeable when master is Windows, slave is Unix



    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Blocker
    • Resolution: Unresolved
    • Labels:
    • Environment:
      Jenkins 2.121.1
      Credentials Binding Plugin 1.16
    • Similar Issues:


      When the Jenkins master is running Windows and the slave is running Unix the path to the secret file is not valid.

      I'm using the plugin to centrally define a Maven settings.xml file. I then reference that variable in the Maven build step.

      The file is correctly copied to the slave, but the path as resolved, and then passed to the -s parameter of the mvn invocation, has had its / characters replaced with \.

      This appears to be due to the path being an absolute path, which jenkins.mvn.FilePathSettingsProvider uses to create a hudson.FilePath by constructing a java.io.File object. This is where the / become \ since this is executed on the Windows master.


      If the path generated by this plugin were relative rather than absolute the jenkins.mvn.FilePathSettingsProvider class looks like it will use string manipulation, without involving the master node's local filesystem code.


      I've attached screenshots of the configuration.

      The result when building looks like:

      Started by user Robert Smith
      Building remotely on slave (UNIX) in workspace /jenkins_home/workspace/my-project
      Cleaning up /jenkins_home/workspace/my-project/.
      Updating http://source-control/svn/my-project/trunk at revision '2018-07-06T15:30:04.873 +0100' --quiet
      Using sole credentials User/****** (Subversion) in realm ‘<http://source-control:80> Subversion’
      At revision 151646No changes for http:/source-control/svn/my-project/trunk since the previous build
      [my-project] $ /jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Apache_Maven_3.0.4/bin/mvn -s \jenkins_home\workspace\my-project@tmp\secretFiles\4c02e1f9-73a8-4c85-91bd-dbaa20c7e30b\settings.xml deploy
      [ERROR] Error executing Maven.
      [ERROR] The specified user settings file does not exist: /jenkins_home/workspace/my-project/\jenkins_home\workspace\my-project@tmp\secretFiles\4c02e1f9-73a8-4c85-91bd-dbaa20c7e30b\settings.xml
      Build step 'Invoke top-level Maven targets' marked build as failure
      Finished: FAILURE



          There are no comments yet on this issue.


            Unassigned Unassigned
            whittlec William Whittle
            0 Vote for this issue
            1 Start watching this issue