Why is Jenkins ignoring the %PATH% variable when using MSBuild?

大城市里の小女人 提交于 2019-12-03 12:39:43

Depending on how you run Jenkins, it may not have the full path line that you are used to seeing. For example, if you run Jenkins as a Windows Service and have your USERS PATH variable populated, you won't necessarily have it populated for the SYSTEM user. In this case, modify the Logon Account used by the Service to be your account, rather than a system one.

bobflorian

I have Jenkins running on a server inside Glassfish, running as the local system account, as it was installed, by using a derivation of this blog post, and I was able to get it to work by setting property variables in the "system configuration" (Jenkins Environment Injector Plug-in) in Jenkins. (BDS, BDSCOMMONDIR, FrameworkDir, FrameworkSDKDir etc...)

Then the trick for Delphi to pick up the appropriate path is to send the command line parameter "Win32LibraryPath" to MSBuild. Make sure to escape your double quotes in this parameter in Jenkins or else you will pull out your hair.

I had Jenkins started as windows service and it could not find an SVN command even if I had SVN\bin in my PATH variable for the System user.

It seems that the service uses only the environment variables available at start up time. So if later on you add some more environment varibales to the Windows System user, they will not be available to the service. All you have to do is restart the window service and it will pick the new environment variables !

Chaitanya T

Anything with git pull/ where git commands, which are not executing from Jenkins is because of the path issue in the environmental variables in Windows.

  1. Check the PATH in Environment variables.
  2. Check the same command executes from windows command prompt or not.
  3. If it is executing & Windows is running as slave service, then restart the slave service from services.msc.
  4. Log out and login back to Jenkins.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!