Jenkins SSH slave无法创建/ home / <user> / jenkins </user>

时间:2014-08-07 08:09:03

标签: linux ssh jenkins amazon-ec2

在Jenkins上配置ssh slave时,在ec2实例上运行,当我点击&#34;启动Slave Agent&#34;时,我收到以下错误消息。

[08/06/14 18:41:46] [SSH] Opening SSH connection to ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:22.
[08/06/14 18:41:46] [SSH] Authentication successful.
[08/06/14 18:41:46] [SSH] The remote users environment is:
[08/06/14 18:41:46] [SSH] Starting sftp client.
[08/06/14 18:41:46] [SSH] SFTP failed. Copying via SCP.
[08/06/14 18:41:46] [SSH] Remote file system root /home/<user>/jenkins does not exist. Will try to create it...
Failed to create /home/<user>/jenkins
[08/06/14 18:41:46] [SSH] Copying latest slave.jar...
hudson.util.IOException2: Could not copy slave.jar into '/home/<user>/jenkins' on slave
    at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:967)
    at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:926)
    at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:596)
    at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:228)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Error during SCP transfer.
    at com.trilead.ssh2.SCPClient.put(SCPClient.java:523)
    at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:965)
    ... 7 more
Caused by: java.io.IOException: Remote scp terminated unexpectedly.
    at com.trilead.ssh2.SCPClient.readResponse(SCPClient.java:50)
    at com.trilead.ssh2.SCPClient.sendBytes(SCPClient.java:140)
    at com.trilead.ssh2.SCPClient.put(SCPClient.java:519)
    ... 8 more
[08/06/14 18:41:46] [SSH] Connection closed.

此节点的Jenkins配置如下:

Jenkins Config

请注意我已经设置了JavaPath属性,因为Jenkins&#34;无法找出java版本的Java&#34; (那是我收到的错误信息)

知道如何解决这个问题吗?感谢

2 个答案:

答案 0 :(得分:1)

我有同样的问题。阅读以下帖子talking about new version后,在我正在使用的SSH插件上发现了一些错误。

所以我访问了管理插件 - &gt;已安装 - &gt;搜索'SSH'(通过删除选择禁用SSH相关客户端)
基本上你需要:

  • 已禁用 - SSH Slaves插件(可能随Jenkins一起提供)
  • 添加了SSH插件(版本2.4)。

解决了这个问题,我已经在第6步JENKINS-SETTING UP MASTER SLAVE ENVIRONMENT的本文档中显示的其他设置之后成功连接了。 (slave.jar -jnlpUrl ....)
希望这将有助于将来的某些人。

答案 1 :(得分:0)

您需要在用户有权访问的ec2实例上提供有效路径。