How to make Hudson write to remote disk

hudsonJenkinsmac-osx-serverserver-message-blockwindows-xp

I have a problem writing to a remote disk using Hudson. When I write in it manually, it works.

The two computers implied: one is on Windows XP and the other is a Mac mini server. The disk that needs to be accessed remotely is on the Mac. I succeeded in the following:

  • Created a user on the Mac
  • Gave it read/write access to the folder to be mounted on the WinXP box
  • Mounted the filesystem on the WinXP machine using the credentials of the user created above
  • Created a couple directories, moved files around, etc. remotely (from the WinXP computer)

But when Hudson runs its build script which I programmed to write things in that mounted folder, it fails, saying

BUILD FAILED
C:\path\to\build.xml:62:
Directory Z:\mac\path creation was not successful for an unknown reason

I can create Z:\mac\path from the same computer (remotely) and it works just fine. In fact, the directory already exists but I want it to try to create it anyway in case it was delete. I do the very same thing on the local disk and it never complained (directory existing or not).

The corresponding Ant instruction would be

<mkdir dir="Z:/mac/path/"/>

I would suspect a permission problem of some kind. Not too sure. The user which mounted the disk on the computer is not SYSTEM… while Hudson is ran by "him". The usernames on the WinXP computer have nothing to do with the Mac user used to mount the remote filesystem (NTFS).

What could I try to do? It is well mounted as Z:. I can browse and edit it no problem. That line still doesn't compute in Hudson though (while it goes through on C:). I wouldn't think it's possible to mount it using SYSTEM… Help, please!

Best Answer

I just solved a similar problem so hopefully this solution works for you ...but it has been 9 months so perhaps it will help the next person. The basic problem is that if Tomcat runs as a service your scripts execute as SYSTEM.

Open a cmd prompt as SYSTEM to test (set time to a minute from now)

at 12:34 /interactive "cmd.exe"

Test away...

C:\.jenkins\jobs\test\workspace>dir \\remotemachine\folder
Access is denied.

Solve by mapping drive as a user with sufficient permissions (in this case write access)

NET USE z: \\remotemachine\folder password /USER:username\domain