p4 PATH using agent side checkout

I'm getting the following error when using TeamCity on a Windows machine with Perforce installed, when trying to use the agent-side checkout that is now in TeamCity 6:
[16:18:47]: Updating sources: agent side checkout...
[16:18:48]: [Updating sources: agent side checkout...] Failed to perform checkout on agent: Cannot find p4 executable in PATH jetbrains.buildServer.vcs.VcsException: Cannot find p4 executable in PATH      at jetbrains.buildServer.vcs.perforce.PerforceSourceUpdater.findP4Command(PerforceSourceUpdater.java:89)      at jetbrains.buildServer.vcs.perforce.PerforceSourceUpdater.updateSources(PerforceSourceUpdater.java:51)      at jetbrains.buildServer.vcs.perforce.PerforceSourceUpdater.updatePerforceSources(PerforceSourceUpdater.java:43)      at jetbrains.buildServer.vcs.perforce.PerforceAgentSupport$1.updateSources(PerforceAgentSupport.java:38)      at jetbrains.buildServer.agent.impl.patch.ProjectSourcesOnAgent.checkoutSources(ProjectSourcesOnAgent.java:72)      at jetbrains.buildServer.agent.impl.patch.UpdateSourcesFromAgent.updateSources(UpdateSourcesFromAgent.java:60)      at jetbrains.buildServer.agent.impl.patch.UpdateSourcesBuildStageBase.doSourceUpdate(UpdateSourcesBuildStageBase.java:90)      at jetbrains.buildServer.agent.impl.patch.UpdateSourcesBuildStageBase.doRecoverableStage(UpdateSourcesBuildStageBase.java:58)      at jetbrains.buildServer.agent.impl.buildStages.startStages.RecoverableBuildStage.doBuildStage(RecoverableBuildStage.java:74)      at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:31)      at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:29)      at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:68)      at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:31)      at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24)      at jetbrains.buildServer.agent.impl.BuildRunAction.doStages(BuildRunAction.java:65)      at jetbrains.buildServer.agent.impl.BuildRunAction.runBuild(BuildRunAction.java:48)      at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:250)      at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:48)      at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:223)      at java.lang.Thread.run(Unknown Source)

The machine's PATH environment variable does contain p4 so I am quite confused by this error.
Here is the PATH:

C:\Program Files (x86)\SN Systems\PS3\bin;C:\Python26;C:\Program Files\System Internals\bin;C:\Program Files\HP\NCU;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AccuRev\bin;C:\Program Files\Perforce

I have rebooted the machine since installing perforce, so the system path picked up by the Agent should be correct.

Any ideas?

7 comments
Comment actions Permalink

Hello Mark,

  Could you please try TeamCity 6.0.1? It has better diagnositics for perforce executable searching.

  I suppose, that you've specified path to p4 on the server, in VCS roots settings, explicitly.
  And on build agent, it tries to find p4 in the same location (but reports search in PATH, which is incorrect)

  As a possible solution, you can also specify TEAMCITY_P4_PATH environment variable on build agent with full path to p4 executable.

  Hope this helps,
  KIR

0
Comment actions Permalink

  Could you please try TeamCity 6.0.1? It has better diagnositics for perforce executable searching.


This is using 6.0.1

  I suppose, that you've specified path to p4 on the server, in VCS roots settings, explicitly.
  And on build agent, it tries to find p4 in the same location (but reports search in PATH, which is incorrect)

  As a possible solution, you can also specify TEAMCITY_P4_PATH environment variable on build agent with full path to p4 executable.


Yes, that may be the problem - the p4 exe is not going to be in the same location on the server as it is on the agent, because the server is an Ubuntu box and the agent is a Windows box!

I'll give the TEAMCITY_P4_PATH environment variable a try.

Thanks!

0
Comment actions Permalink

I have fixed this by changing my path to p4 to just be 'p4' and putting p4 in the path on my TeamCity server.
I did this by adding a symbolic link into /usr/local/bin/p4 --> location of p4, for anyone interested.


This then makes TeamCity just search for p4 in the system PATH on both Linux, Windows and I assume Mac too -- so this is now working for me.

Many thanks for the help!

Cheers,

Mark

0
Comment actions Permalink

Ahh, I spoke to soon. This now works on Linux (server) and Windows agent, but on a Mac Agent it is not working.

I get the same error again "Failed to perform checkout on agent: Cannot find p4 executable in PATH"

But p4 is in /usr/local/bin and has been made executable by all users with chmod a+x.



If I start a terminal and type 'p4' I can run p4.


Is there anything else on a Mac agent I need to do to get it to find p4? Does the Mac Agent run with some different PATH?
0
Comment actions Permalink

Actually I just spotted (by running a very simple 'build step' that just ran the 'set' command) that the PATH on the Mac Agent is not the same as the path when you log in:

PATH=/usr/bin:/bin:/usr/sbin:/sbin

So this must be why my /usr/local/bin/p4 is not being found!

I'll sort that out and then hopefully it will work.

Update: yes it does work on the mac now! phew!

0
Comment actions Permalink

Mark,

  Try setting TEAMCITY_P4_PATH in Mac's buildAgent/conf/buildAgent.properties file:
  env.TEAMCITY_P4_PATH=/usr/local/bin/p4

  Hope this helps,
  KIR

0
Comment actions Permalink

maxkir wrote:

Mark,

  Try setting TEAMCITY_P4_PATH in Mac's buildAgent/conf/buildAgent.properties file:
  env.TEAMCITY_P4_PATH=/usr/local/bin/p4

  Hope this helps,
  KIR



Thanks, I'm sure that would have worked as well, I'm just trying to keep the amount of stuff in the buildAgent.properties files to a minimum. :-)

0

Please sign in to leave a comment.