无法使Jenkins perforce插件与ssh一起使用

时间:2014-04-30 07:49:06

标签: jenkins perforce jenkins-plugins

我对Jenkins不是很熟悉,但由于某些原因我无法使perforce插件工作。我将列出问题和我尝试过的内容,以便更好地理解。

詹金斯版本 - 1.561

Perforce插件版本 - 1.3.27(我在Jenkins中配置了perforce路径)

系统 - Ubuntu 10.04

问题:

在源代码管理的项目详细信息部分(当您尝试配置新作业时),我得到" 无法检查工作区与仓库"错误。

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

我让Jenkins通过选中"让Jenkins创建工作区" "让Jenkins管理工作区视图&#的复选框来创建工作区并管理其视图34;

客户端视图类型是查看地图,其中包含以下映射:

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

我在启动jenkins之前加载了密钥,jenkins进程以我的用户身份运行(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

此外,我使用了 envInject 插件和"在为运行准备环境" 我添加了 SSD_AGENT_PID SSH_AUTH_SOCK P4USER P4PORT 环境参数。 (我确实试过没有envInject但面临同样的问题)

看起来像是一些身份验证问题,因为我仔细检查了p4可执行文件的路径以及项目映射和向我的环境添加了密钥。

以下是表示运行失败的日志文件:

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 个答案:

答案 0 :(得分:1)

P4PORT的格式通常为'hostname.port'。例如:

workshop.perforce.com:1666

myserver.mycompany.net:2500

以下是一些文档:http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4PORT.html