Search code examples
jenkinsenvironment-variableshudson

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?


Solution

  • 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.