Question

I have perforce installed on my ubuntu server and am accessing it from a Windows XP machine on the same network. It is located at mysql:1667. I am able to access perforce via p4v from the windows machine.

I installed jenkins on the same server, and can access it via mysql:8080. I have installed the perforce plugin, and put set the file location at usr/local/bin/p4.

When I try to create a new project, I put in the info mysql:1667, jenkins, XXXXXXXX, jenkins_space (which has been created and is listed among the workspaces in p4v), I see the red "unable to check workspace against depot". Reading that this is possibly a misleading error message, I try to do a build anyway (with absolutely no build commands). The "build" fails, and I get the following:

Started by user anonymous  
Building in workspace /var/lib/jenkins/workspace/test7  
Using master perforce client: jenkins_space  
[test7] $ /usr/local/bin/p4 workspace -o jenkins_space  
Caught exception communicating with perforce. Connect to server failed; check $P4PORTcom.tek42.perforce.PerforceException: Connect to server failed; check $P4PORT  
    at com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:406)  
    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:1545)  
    at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1506)  
    at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:843)  
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1414)  
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)  
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)  
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:561)  
    at hudson.model.Run.execute(Run.java:1678)  
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)  
    at hudson.model.ResourceController.execute(ResourceController.java:88)  
    at hudson.model.Executor.run(Executor.java:231)  
ERROR: Unable to communicate with perforce. Connect to server failed; check $P4PORT
Finished: FAILURE

Any ideas what I might have/be doing wrong?

Thank you, Brian

Was it helpful?

Solution

The error is indicating that it isn't connecting to the server. There's nothing in the logs indicating that the calls to perforce are getting a valid P4PORT and they aren't being sent command-line arguments.

Double-check that your Source Code Management plugin in your Job is configured as you expect it to be. The P4PORT should be coming from Jenkins immediately before the first p4 command is generated (although it won't appear in the logs).

Generally "Unable to check workspace against depot" is a valid diagnostic. If you get "Workspace does not exist", that may be bogus, due to a number of factors, but the "Unable to check" error tends to indicate that a connection can't be made or there is an authentication failure.

If you are using SSL, make sure you put that in the connection string as well (ssl:mysql:1667 as an example), since that will cause a connection failure, although it should generate a different message in the logs.

OTHER TIPS

I faced a similar issue and restarting the jenkins server on the slave machine worked for me.

Check the configuration in jenkins and ensure that the user used for perforce has valid permissions and the P4PORT settings are correct.Once you are done,restart the jenkins service in the slave.

Seems like jenkins was still using the old settings which was causing the failure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top