Jenkins slave path for workspace

987 views
Skip to first unread message

Terry O'Leary

unread,
Jun 19, 2017, 4:30:05 PM6/19/17
to Jenkins Users
Hello,

I am currently in the middle of upgrading from an older version of Jenkins (1.534) in a standalone configuration, to the latest version (2.65) with a Master / Slave Node configuration. I am basically standing up the new Jenkins Master / Slave Node servers and using the job import plugin to pull in the jobs from the old server. The jobs import fine and I can run them on the Master with no issues since the path (c:\env\jenkins\jobs\JOBNAME\workspace) is the same. However, when I attempt to run the same jobs on the slave nodes, the paths (c:\env\jenkins\workspace\JOBNAME\) change.

Here is an example of what I mean:

Master server:
C:\env\jenkins\jobs\job_name\workspace

Slave server:
C:\env\jenkins\workspace\job_name\

I have tried a the option where I set the environment variable on the slave node configuration to "$WORKSPACE = jobs\${ITEM_ROOTDIR}\workspace" but I still see the console output showing the default path:

Building remotely on SERVERNAME (1 Slave) in workspace C:\env\jenkins\workspace\JOBNAME

Then when the job goes to compile, it uses the environment variable I added:

c:\env\jenkins\jobs\JOBNAME\workspace\dist

I have tried researching thiws issue and found many different answers. Just looking to get past this hurdle.

Thanks!
Terry

Terry O'Leary

unread,
Jun 22, 2017, 2:02:39 PM6/22/17
to Jenkins Users
The other option I tried was to use the slaveworkspaceroot model in the Jenkins XML. Has anyone successfully used "hudson.model.Slave.workspaceRoot" within the jenkins.xml on the master to modify the path? 
I have tried this, but it doesn't seem to work. Maybe I have a syntax issue? Here is what I have tried:

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war" -Dhudson.model.Slave.workspaceRoot=c:\ </arguments>

I then import a job from the old Jenkins and run it, yet the salve still puts the workspace on "Building remotely on walrebuildsla01 (1 Slave) in workspace C:\env\jenkins\workspace\"

Any input would be much appreciated!
Terry

Terry O'Leary

unread,
Jun 26, 2017, 4:53:25 PM6/26/17
to Jenkins Users
Well, I was never able to figure out how to properly set the "-Dhudson.model.Slave.workspaceRoot=path" in the jenkins.xml, but I did find that if I set the custom workspace in each job, it then sets the path I am expecting.

In the General section of each job clicking on the advanced button, I check "Use custom workspace" and set the path "${JENKINS_HOME}\jobs\jobname\workspace".

Not the best solution, but it get's me past my hurdle. I thought the other 2 solutions would have worked but they did not. If there was 1 place to set the workspace for each slave node that was consistent that would have been optimal.

Thanks,
Terry

On Monday, June 19, 2017 at 4:30:05 PM UTC-4, Terry O'Leary wrote:

Daniel Beck

unread,
Jun 28, 2017, 4:17:04 PM6/28/17
to jenkins...@googlegroups.com

> On 19. Jun 2017, at 18:20, Terry O'Leary <teeo...@gmail.com> wrote:
>
> I can run them on the Master with no issues since the path (c:\env\jenkins\jobs\JOBNAME\workspace) is the same. However, when I attempt to run the same jobs on the slave nodes, the paths (c:\env\jenkins\workspace\JOBNAME\) change.

it's unclear why what you describe is a problem. This looks like the sort of issue encountered when doing something typically considered wrong, such as relying on persistent, externally provided data in the job workspace.
Reply all
Reply to author
Forward
0 new messages