Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-18297

Can not set PATH environment variable on master node

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • envinject-plugin
    • Jenkins 1.517, envInject 1.87. Master runs on i686 CentOS 5.8. Slave nodes on various CentOS, Redhat and Windows versions.

      The PATH environment variable is not set properly on the master. I have tried configuring the PATH variable in:

      • the Manage Jenkins -> Configure System -> Global Properties.
      • and in the Node Properties -> Environment variables section on the master node Configure screen.

      With a simple job that is tied to the master node and prints the PATH variable, I see only a default-looking PATH=/sbin:/usr/sbin:/bin:/usr/bin.

      The job does properly print other environment variables that I have configured on the master.

      I recently upgraded from 1.498 to 1.517 along with many plugins, including EnvInject 1.78 to 1.87. This was not a problem with my previous installation.

      Downgrading from EnvInject 1.87 to 1.78 resolved the problem.

          [JENKINS-18297] Can not set PATH environment variable on master node

          J R added a comment -

          I can confirm this regression. It seems to be a problem for master but not for slaves, all CentOS in my case.

          Tested envinject versions:
          1.87 fail
          1.83 fail
          1.80 success

          J R added a comment - I can confirm this regression. It seems to be a problem for master but not for slaves, all CentOS in my case. Tested envinject versions: 1.87 fail 1.83 fail 1.80 success

          I also confirm this issue. Using version 1.87 with Jenkins 1.502.

          Has there been any progress on resolving this?

          Henrik Holmberg added a comment - I also confirm this issue. Using version 1.87 with Jenkins 1.502. Has there been any progress on resolving this?

          Stan Towianski added a comment - - edited

          PATH not getting set. other var's do after restart jenkins.

          C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\programs\Java\jdk1.7.0_25\bin;d:\perl\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;;d:\perl\bin

          in a node/master level env.properties file:

          JAVA_HOME=d:\build-tools\jdk1.7.0_25\bin
          PERL_HOME=d:\build-tools\perl-5.6.1
          PATH=$PATH;$PERL_HOME\bin

          all my env var's in my path are OLD values. I don't know where they are coming from.
          java and perl paths in PATH are old.

          windows 2012 server 64-bit, jenkins 1.533

          I did get it to work now I think by rebooting the whole windows system.

          Stan Towianski added a comment - - edited PATH not getting set. other var's do after restart jenkins. C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\programs\Java\jdk1.7.0_25\bin;d:\perl\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;;d:\perl\bin in a node/master level env.properties file: JAVA_HOME=d:\build-tools\jdk1.7.0_25\bin PERL_HOME=d:\build-tools\perl-5.6.1 PATH=$PATH;$PERL_HOME\bin all my env var's in my path are OLD values. I don't know where they are coming from. java and perl paths in PATH are old. windows 2012 server 64-bit, jenkins 1.533 I did get it to work now I think by rebooting the whole windows system.

          Sebastian Schuberth added a comment - - edited

          Still present in EnvInject 1.90, Jenkins 1.580.2. Environment variables set globally or at the node level in the standard Jenkins fields to not get propagated to jobs anymore, even if EnvInject's "Prepare jobs environment" is disabled. Also enabling "Prepare jobs environment" but disabling "Unset System Environment Variables" (which is checked by default) does not help.

          Sebastian Schuberth added a comment - - edited Still present in EnvInject 1.90, Jenkins 1.580.2. Environment variables set globally or at the node level in the standard Jenkins fields to not get propagated to jobs anymore, even if EnvInject's "Prepare jobs environment" is disabled. Also enabling "Prepare jobs environment" but disabling "Unset System Environment Variables" (which is checked by default) does not help.

          Ken Huie added a comment -

          Present in EnvInject 1.90 and Jenkins 1.601. It works by downgrading EnvInject to 1.85.

          Ken Huie added a comment - Present in EnvInject 1.90 and Jenkins 1.601. It works by downgrading EnvInject to 1.85.

          Cheng-Yu Pai added a comment -

          Still present in EnvInject 1.91.3 and Jenkins 1.617.

          Cheng-Yu Pai added a comment - Still present in EnvInject 1.91.3 and Jenkins 1.617.

          I have same issue. Strange thing is that I set PATH in global configuration, in build I can see unmodified PATH, but when I set job 'Prepare an environment for the run' -> 'Properties Content' to PATH=$PATH, then PATH from global setting is in build.

          Michal Kovarik added a comment - I have same issue. Strange thing is that I set PATH in global configuration, in build I can see unmodified PATH, but when I set job 'Prepare an environment for the run' -> 'Properties Content' to PATH=$PATH, then PATH from global setting is in build.

          Still seeing this on EnvInject 2.1.3, EnvInject API 1.2 and Jenkins 2.46.2 with both Linux and Windows agents, it just doesn't change the PATH variable at all from either a properties file or by giving PATH as a node setting.

          Andrew Johnson added a comment - Still seeing this on EnvInject 2.1.3, EnvInject API 1.2 and Jenkins 2.46.2 with both Linux and Windows agents, it just doesn't change the PATH variable at all from either a properties file or by giving PATH as a node setting.

            gbois Gregory Boissinot
            dbacher Dave Bacher
            Votes:
            23 Vote for this issue
            Watchers:
            26 Start watching this issue

              Created:
              Updated: