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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With