Not able to make Jenkins perforce plugin to work with ssh

狂风中的少年 提交于 2021-02-05 06:50:47

问题


I am not quite familiar with Jenkins but for some reason I am not able to make the perforce plugin to work. I will list down the problem and what I have tried so as to get a better understanding.

Jenkins Version - 1.561

Perforce Plugin Version - 1.3.27 (I have perforce path configured in Jenkins)

System - Ubuntu 10.04

Problem:

In the Source Code Management's Project Details section ( when you try to configure a new job ) I get "Unable to check workspace against depot" error.

P4PORT(hostname:port) - rsh:ssh -q -a -x -l p4ssh -q -x xxx.xxx.com /bin/true
Username              - ialok
Password              - N.A (Connection to SCM is via key authentication so left it blank)
Workspace(client)     - ialok_jenkins

I let Jenkins create workspace and manage its view by checking the checkbox for both "Let Jenkins Create Workspace" and "Let Jenkins Manage Workspace View"

Client View Type is a View Map with the following mapping:

//sandbox/srkamise/... //ialok_jenkins/srkamise/...

I have the keys loaded prior to starting jenkins and the jenkins process runs as my user (ialok)

~$ ps aux | grep jenkins
ialok    16608  0.0  0.0  14132   552 ?        Ss   11:08   0:00 /usr/bin/daemon --name=ialok --inherit --env=JENKINS_HOME=/var/lib/jenkins --output=/var/log/jenkins/jenkins.log --pidfile=/var/run/jenkins/jenkins.pid -- /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
ialok    16609  1.0 13.9 1448716 542156 ?      Sl   11:08   1:04 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1

Additionally, I used envInject plugin and "Under Prepare an environment for the run" I added SSD_AGENT_PID, SSH_AUTH_SOCK, P4USER, P4PORT environment parameters. (I did try without envInject but faced the same issue)

It looks like some authentication problem as I double checked the path to p4 executable along with the project mapping and addition of keys to my environment.

Here is the log file indicating a failed run:

Started by user anonymous
[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Injecting as environment variables the properties content 
P4CONFIG=.perforce
P4PORT=rsh:ssh -q -a -x -l p4ssh -q -x xxx.xxx.com /bin/true
P4USER=ialok
SSH_AGENT_PID=25752
SSH_AUTH_SOCK=/tmp/keyring-7GAS75/ssh

[EnvInject] - Variables injected successfully.
[EnvInject] - Injecting contributions.
Building in workspace /var/lib/jenkins/jobs/fin/workspace
Using master perforce client: ialok_jenkins
[workspace] $ /usr/bin/p4 workspace -o ialok_jenkins
Changing P4 Client Root to: /var/lib/jenkins/jobs/fin/workspace
Changing P4 Client View from:


Changing P4 Client View to: 
  //sandbox/srkamise/... //ialok_jenkins/srkamise/...
Saving new client ialok_jenkins
[workspace] $ /usr/bin/p4 -s client -i
Caught exception communicating with perforce.  TCP receive failed. read: socket: Connection reset by peer
For Command: /usr/bin/p4 -s client -i 
With Data:
===================
Client: ialok_jenkins
Description: 
Root: /var/lib/jenkins/jobs/fin/workspace
Options: noallwrite clobber nocompress unlocked nomodtime rmdir
LineEnd: local
View:
  //sandbox/srkamise/... //ialok_jenkins/srkamise/...


===================
com.tek42.perforce.PerforceException:  TCP receive failed. read: socket: Connection reset by peer
For Command: /usr/bin/p4 -s client -i 
With Data:
===================
Client: ialok_jenkins
Description: 
Root: /var/lib/jenkins/jobs/fin/workspace
Options: noallwrite clobber nocompress unlocked nomodtime rmdir
LineEnd: local
View:
  //sandbox/srkamise/... //ialok_jenkins/srkamise/...


===================

    at com.tek42.perforce.parse.AbstractPerforceTemplate.saveToPerforce(AbstractPerforceTemplate.java:270)
    at com.tek42.perforce.parse.Workspaces.saveWorkspace(Workspaces.java:77)
    at hudson.plugins.perforce.PerforceSCM.saveWorkspaceIfDirty(PerforceSCM.java:1787)
    at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:895)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1251)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513)
    at hudson.model.Run.execute(Run.java:1709)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:231)
ERROR: Unable to communicate with perforce.  TCP receive failed. read: socket: Connection reset by peer
For Command: /usr/bin/p4 -s client -i 
With Data:
===================
Client: ialok_jenkins
Description: 
Root: /var/lib/jenkins/jobs/fin/workspace
Options: noallwrite clobber nocompress unlocked nomodtime rmdir
LineEnd: local
View:
  //sandbox/srkamise/... //ialok_jenkins/srkamise/...


===================

Finished: FAILURE

回答1:


The P4PORT typically is of the form 'hostname.port'. Examples would be:

workshop.perforce.com:1666

myserver.mycompany.net:2500

Here's some docs: http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4PORT.html



来源:https://stackoverflow.com/questions/23382486/not-able-to-make-jenkins-perforce-plugin-to-work-with-ssh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!