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

plicqrtu  于 2023-10-17  发布在  Jenkins
关注(0)|答案(4)|浏览(132)

当在Jenkins上配置ssh slave时,它运行在ec2示例上,当我点击“Launch Slave Agent”时,我得到以下错误消息。

[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配置如下:

请注意,我已经设置了JavaPath属性,因为Jenkins“无法确定Java的Java版本”(这是我得到的错误消息)
任何想法我如何解决这个问题?谢谢

2ekbmq32

2ekbmq321#

我也有同样的问题。在阅读下面的帖子talking about new version后,意识到我使用的SSH插件有问题。
所以我访问了管理插件-->安装-->搜索'SSH'(通过删除选择禁用SSH相关客户端)
基本上你需要:

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

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

yyyllmsg

yyyllmsg2#

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

8iwquhpp

8iwquhpp3#

我遇到了同样的事情,没有环境变量远程用户环境是:(空). ..
我为jenkins用户设置了一个新的主目录(例如:/jenkinsFolder)并在/etc/passwd中启用了jenkins的shell(它被禁用了),然后我就可以在启动从站时看到环境变量了。

c8ib6hqw

c8ib6hqw4#

上述配置有两个错误:
1 . java路径

$ which java
/usr/bin/java

1.远程FS根目录。创建一个目录并添加它的完整路径。

$mkdir -p /home/jenkins/node-files

相关问题