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

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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

        1. config.png
          82 kB
          William Whittle

            Assignee:
            Unassigned
            Reporter:
            William Whittle
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: