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

The workspace variable is initialized wrong when building on a windows slave (from a linux master)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • buckminster-plugin
    • None

      Hi everyone

      At the moment I am facing a really weird behaviour in the buckminster plugin. The WORKSPACE
      variable is initialized with a mix of the linux and windows path.

      I have the following setup:

      • Master on Linux RHEL 4/5
      • Slave on Windows Server 2008 R2
      • On both sides the same buckminster version
      • On both sides the same java version (1.6.0_20)

      I configured a test job with two build steps to run on the slave. The first build step only
      executes "echo %WORKSPACE%" as a Windows Batch command. The second build step executes buckminster
      with just a "setpref targetPlatformPath=${WORKSPACE}/targetPlatform" in commands field.

      This generates the following output:
      Started by user anonymous
      Building remotely on Desktop_Slave
      [TestJob] $ cmd /c call C:\Users\ts_hudson\AppData\Local\Temp\2\hudson5004380686278716431.bat

      D:\hudson_slaves\tempslave\workspace\TestJob>echo D:\hudson_slaves\tempslave\workspace\TestJob
      D:\hudson_slaves\tempslave\workspace\TestJob

      D:\hudson_slaves\tempslave\workspace\TestJob>exit 0
      [TestJob] $ D:\Java\jdk1.6.0_20\bin\java.exe -Dbuckminster.output.root=D:\hudson_slaves\tempslave\workspace\TestJob\buckminster.output -Dbuckminster.temp.root=D:\hudson_slaves\tempslave\workspace\TestJob\buckminster.temp -Xmx256m -jar D:\Buckminster\headless-3.6\plugins\org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar -application org.eclipse.buckminster.cmdline.headless -data D:\hudson_slaves\tempslave\workspace\TestJob --loglevel debug -S D:\hudson_slaves\tempslave\workspace\TestJob\commands.txt
      setpref 'targetPlatformPath=/home/hudson/CodeRelease/BuckiJenkins/D:hudson_slavesempslaveworkspaceTestJob/targetPlatform'
      WARN: Target platform directory '/home/hudson/CodeRelease/BuckiJenkins/D:hudson_slavesempslaveworkspaceTestJob/targetPlatform' does not exist and will be created
      Doing full workspace refresh
      Waiting for jobs to end
      org.osgi.service.prefs.BackingStoreException: Unable to create target platform directory '/home/hudson/CodeRelease/BuckiJenkins/D:hudson_slavesempslaveworkspaceTestJob/targetPlatform'
      Finished: FAILURE

      As you can see, the workspace variable has correctly been set on the slave, but the buckminster plugin
      somehow is expanding it the wrong way. I had a look at the source code of the buckminster plugin. I think
      the problem is, if you call the method 'toURI()' on a File, an absolute path will be created previously
      (by calling File#getAbsolutePath()). So with an unavailable path (e.g. new File("D:/does/not/exist"))
      this will lead to a path with the user.dir prefixed.

      Try new File("D:/does/not/exist").toURI() and you will get file://User/Dir/D:/does/not/exist.

      This happens on the latest jenkins 1.403 with buckminster plugin 1.0.8
      and on an older hudson 1.380 with buckminster plugin 1.0.8

            jutzig jutzig
            mrbobbi guidap
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: