Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a env variables for slave node home in JENKINS?

Tags:

jenkins

We know there's a environment variable named JENKINS_HOME so we can use it anywhere as $JENKINS_HOME. But now when I running projects on slave nodes, I need to use the home directory of jenkins (which named "remote FS root" when defining a slave node) on slave node as a variable. And I found $JENKINS_HOME always be the home directory of jenkins on master node even I'm running projects on slave node.

Anyone can help? Thank you!

like image 369
XiaoYao Avatar asked Apr 12 '12 02:04

XiaoYao


1 Answers

Old question, but seems never answered

The variable is not directly exposed in the job's environment, but you can figure it out ...

By default (ie: you did not set a custom workspace),

WORKSPACE=<RemoteFS>/<JOB_NAME>
and JOB_NAME includes folders if you use them.

ie: WORKSPACE=/path/to/remoteFSroot/myfolder/jobname
and JOB_NAME=myfolder/jobname

You can manipulate from there. But, there should be no need to store the data inside the remoteFS root and is even probably a bad idea, since you should be able to delete all the workspaces w/o impacting your data. Just store it in another directory (or even an NFS shared across all you slaves) and reference with a complete path.

like image 196
Ian W Avatar answered Nov 09 '22 22:11

Ian W