Yes, that is the expected behavior. JENKINS_HOME only matters on Jenkins master. JENKINS_HOME is the path where all metadata of Jenkins instance like plugins, jobs are stored. It is not a variable for slave. Are you the Jenkins admin such that you have administration permission on the Jenkins UI?
Why don’t you define an environment variable with different name in the Manage Jenkins -> Configure System. This env variable is then available to all jobs regardless where the job is running. From: <jenkinsci-users@googlegroups.com> on behalf of Bruce Epstein <goo...@zeusprod.com> Reply-To: "jenkinsci-users@googlegroups.com" <jenkinsci-users@googlegroups.com> Date: Wednesday, February 1, 2017 at 1:48 PM To: Jenkins Users <jenkinsci-users@googlegroups.com> Subject: $JENKINS_HOME vs. $WORKSPACE on a slave (agent) node vs master node Hi Everyone - I have one master and one slave node. I am trying to move some Jenkins jobs that currently run on the master to instead run on the slave. For various reasons, I need (or at least want) to use the $JENKINS_HOME env variable in my scripts, but it returns the value of the master jenkins localtion, even when running a job on the slave. On the master node, $JENKINS_HOME is /opt/apache-tomcat-7.0.54/webapps/jenkins On the slave node, $JENKINS_HOME should be /opt/jenkins, but is being returned as the master's value ( /opt/apache-tomcat-7.0.54/webapps/jenkins) For now, the best I have been able to do is climb up the directory hierarchy, using something like: $WORKSPACE/../../../.. So $WORKSPACE is returning the workspace location correctly on the slave, but $JENKINS_HOME is returning the jenkins installation folder on the master. Is this the expected behavior? Is there another env variable I should be using? Regardless, I have hundreds of Jenkins jobs, and tweaking them all will be painful if I can't simply modify $JENKINS_HOME on which they currently rely. I think it is an IT configuration issue, because they say that when they echo $JENKINS_HOME it gives the expected value on the slave node, as follows: [jenkins@builder01-slave01 ~]$ echo $JENKINS_HOME /opt/jenkins Maybe the Jenkins process was started as "root" and not as the "jenkins" user, and they've defined $JENKINS_HOME for the wrong user? If it is an IT-related configuration and not a Jenkins thing, please give advice and I'll rely it onto the IT dept, who control the server config. Thanks in advance Cheers Bruce -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/502de496-603d-4c3f-935a-a723c0821e6b%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/502de496-603d-4c3f-935a-a723c0821e6b%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4FD0804E-C393-4F0C-BA61-431687833367%40cisco.com. For more options, visit https://groups.google.com/d/optout.