Jenkins / Hudson environment variables
I am running Jenkins from user jenkins
thats has $PATH
set to something and when I go into Jenkins web interface, in the System Properties window ( http://$host/systemInfo
) I see a different $PATH
.
I have installed Jenkins on Centos with the native rpm from Jenkins website. I am using the startup script provided with the installation using sudo /etc/init.d/jenkins start
Can anyone please explain to me why that happens?
Michael,
Two things:
When Jenkins connects to a computer, it goes to the sh
shell, and not the bash
shell (at least this is what I have noticed - I may be wrong). So any changes you make to $PATH in your bashrc file are not considered.
Also, any changes you make to $PATH in your local shell (one that you personally ssh into) will not show up in Jenkins.
To change the path that Jenkins uses, you have two options (AFAIK):
1) Edit your /etc/profile
file and add the paths that you want there
2) Go to the configuration page of your slave, and add environment variable PATH
, with value: $PATH:/followed-by/paths/you/want/to/add
If you use the second option, your System Information will still not show it, but your builds will see the added paths.
I kept running into this problem, but now I just add:
source /etc/profile
As the first step in my build process. Now all my subsequent rules are loaded for Jenkins to operate smoothly.
You can also edit the /etc/sysconfig/jenkins
file to make any changes to the environment variables, etc. I simply added source /etc/profile
to the end of the file. /etc/profile
has all all of the proper PATH
variables setup. When you do this, make sure you restart Jenkins
/etc/init.d/jenkins restart
We are running ZendServer CE which installs pear, phing, etc in a different path so this was helpful. Also, we don't get the LD_LIBRARY_PATH
errors we used to get with Oracle client and Jenkins.
上一篇: 访问当前的内部版本号?
下一篇: 詹金斯/哈德森环境变量