Why is Jenkins ignoring the %PATH% variable when u

2020-06-15 03:47发布

I am trying to use Jenkins to compile my MSBuild project created with Delphi. I have the MSBuild plugin installed into Jenkins and configured. I'm choosing the specific configuration for my build job.

I have set all the environmental variables in Jenkins that are required by the Delphi compiler (from rsvars.bat for you Delphi types.)

The project compiles just fine on the command line. If I do it on the command line, MSBuild reports a nice big fat PATH (the correct one) as part of the command line it uses to call the Delphi compiler.

However, when I try to use it with Jenkins, the result is quite different:

C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin\dcc32.exe -$D- -$L- -$Y- --no-config -B -Q -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DRELEASE -K00400000   HTMLWriterTestApp.dpr   
  Embarcadero Delphi for Win32 compiler version 22.0
  Copyright (c) 1983,2010 Embarcadero Technologies, Inc.

Noet the complete lack of a path, or any other information about were to find what the compiler needs. This information is there when I run from the command line.

Can anyone think of any reason why Jenkins is failing to get the correct PATH information?

4条回答
成全新的幸福
2楼-- · 2020-06-15 04:17

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.
查看更多
【Aperson】
3楼-- · 2020-06-15 04:21

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.

查看更多
该账号已被封号
4楼-- · 2020-06-15 04:23

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.

查看更多
够拽才男人
5楼-- · 2020-06-15 04:41

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 !

查看更多
登录 后发表回答