在Mac上为jenkins,未正确设置PATH,否/usr/local/bin
我最近使用Homebrew安装了Jenkins.我还使用Homebrew安装了Mercurial.
I recently installed Jenkins, using Homebrew. I also installed Mercurial using Homebrew.
我可以成功地从终端克隆一个hg存储库.但是,如果我尝试在詹金斯工作中做同样的事情,它就会失败.
I can successfully clone an hg repo just fine - from Terminal. But if I try and do the same thing as part of a job in Jenkins, it fails.
因此,在工作上,我告诉詹金斯运行Shell脚本echo $PATH
.当然,路径/usr/local/bin
不存在.如果我从Terminal执行相同的命令,它就会在那里.
So, in by job, I told Jenkins to run a shell script echo $PATH
. Sure enough, the path /usr/local/bin
is not there. If I execute the same command from Terminal, it's there.
那么,什么是修改PATH的最佳方法,以使Jenkins从终端回显时提取与我正在使用的PATH相同的东西?
请注意,Jenkins的运行帐户与我登录这些测试时所使用的用户帐户相同,所以我无法理解为什么会发生这种情况.
Note, Jenkins is running from the same user account that I'm logged into doing these tests, so I can't fathom why this is happening.
在为Jenkins启动的.plist文件中,可以使用以下命令设置PATH环境变量:
In your launchd .plist file for Jenkins, you can set the PATH environment variable by using the following:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>(insert your path value here)</string>
</dict>
那应该将PATH设置为您需要的任何值.
That should set the PATH to whatever you need.