Jenkins的P4命令行客户端在OSX上发布

时间:2014-07-10 19:57:26

标签: jenkins perforce

我一直在讨论这个问题,但还没有找到解决办法。我使用Jenkins网站上的Jenkins 1.571安装程序在我的OSX v10.8.4上安装了Jenkins。 它默认安装在/ Users / Shared / Jenkins / Home文件夹中。

我想使用Jenkins作为我的iOS代码的CI服务器,驻留在我公司的perforce服务器上。为此,我在OSX框上创建了一个用户(与我的perforce用户的用户名相同)。我还将P4命令行复制到/ usr / local / bin并正确设置P4PORT以指向我的perforce服务器设置。到目前为止一切都很好。

我验证了我能够通过使用p4 login命令从命令行连接到我的perforce服务器,并且它成功运行。

然后我从Jenkins Manage plugins选项(https://wiki.jenkins-ci.org/display/JENKINS/Perforce+Plugin)安装了perforce插件。 现在,当我创建一个新作业并在jenkins作业的perforce插件中正确指定设置时,我总是会遇到这些错误:

   Started by user anonymous
   Building in workspace /Users/Shared/Jenkins/Home/jobs/iosbuild/workspace
   Using master perforce client: ios-jenkins
   [workspace] $ p4 workspace -o ios-jenkins
   Caught exception communicating with perforce. Could not run perforce           command.com.tek42.perforce.PerforceException: Could not run perforce command.
    at hudson.plugins.perforce.HudsonP4DefaultExecutor.exec(HudsonP4DefaultExecutor.java:90)
    at             com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:331)
    at     com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:301)
    at com.tek42.perforce.parse.Workspaces.getWorkspace(Workspaces.java:61)
    at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1615)
    at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1576)
    at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:892)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
    at     hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
    Caused by: java.io.IOException: Cannot run program "p4" (in directory    "/Users/Shared/Jenkins/Home/jobs/iosbuild/workspace"): error=2, No such file or directory
    at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:457)
    at hudson.Proc$LocalProc.(Proc.java:244)
    at hudson.Proc$LocalProc.(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:780)
    at hudson.Launcher$ProcStarter.start(Launcher.java:360)
    at hudson.plugins.perforce.HudsonP4DefaultExecutor.exec(HudsonP4DefaultExecutor.java:81)
    ... 14 more
    Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.(UNIXProcess.java:53)
    at java.lang.ProcessImpl.start(ProcessImpl.java:91)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 19 more
    ERROR: Unable to communicate with perforce. Could not run perforce command.
    Finished: FAILURE`

首先我指定了perforce jenkins插件来为我创建工作区,并让jenkins管理我的视图,但我仍然遇到同样的错误。 以下是我的查看地图:

//depot/rombay/MarketingApplication/iOS/ianywhere/... //ios-jenkins/depot/rombay/MarketingApplication/iOS/anywhere/...

然后我使用p4v客户端创建了一个工作区,然后取消选择让jenkins创建我的工作区并管理我的视图。视图保持不变。但是,我仍然得到同样的错误。

我的预感是,由于Jenkins安装在共享文件夹中,因此无法执行p4命令。但是,我尝试这样做,它为我打开了vi中的clientspec,这是我猜的预期行为,但我仍然不明白为什么它说它无法找到p4程序为我工作

在这里的任何帮助都会深深体会到,因为我已经没想到我可能做错了什么。

1 个答案:

答案 0 :(得分:0)

不需要软链接。检查是否更新了p4的全局设置。管理Jenkins->全局设置