Jenkins 控制器在 Amazon 实例上运行,代理机器设置在专用的 Soyoustart 机器上。工作正常,直到需要重做代理设置:重新安装操作系统,安装 Java,将控制器密钥添加到代理的
authorized_keys
,并再次删除/添加控制器的 known_hosts
中的代理。为代理设置新凭据并在 Jenkins 控制器中配置节点,但无法连接到代理。
设置与其他代理相同,并且一直在与其他代理合作,没有出现任何问题。唯一不同的是,这次新代理与旧代理的 IP 是同一台机器。
可以通过 CLI 从控制器计算机 ssh 到代理计算机(在本文中用占位符替换文件名和代理 IP):
$ ssh -i <key-file> jenkins@<agent-ip>
凭证已设置:
节点已配置:
连接到代理时的输出:
[05/17/15 07:30:31] [SSH] Opening SSH connection to <agent-ip>.
Key exchange was not finished, connection is closed.
ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
java.lang.IllegalStateException: Connection is not established!
at com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:1030)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.getRemainingAuthMethods(TrileadSSHPublicKeyAuthenticator.java:88)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.canAuthenticate(TrileadSSHPublicKeyAuthenticator.java:80)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:207)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:169)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1173)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:701)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
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:745)
[05/17/15 07:30:31] Launch failed - cleaning up connection
[05/17/15 07:30:31] [SSH] Connection closed.
版本号:
对于那些喜欢深入研究代码的人:
我在这里遗漏了一些明显的东西吗?可能是什么原因造成的?有什么已知的解决方法吗?或者它看起来像一个需要报告的错误吗?
如果需要更多信息,请告诉我。
我正在使用官方 Docker 映像运行 Jenkins master,该映像使用 OpenJDK8,不需要安装 JCE。
我当前的解决方法是注释掉
Jenkins Slave的
MACs
中的 KexAlgorithm
和 /etc/ssh/sshd_config
行并重新启动 sshd(在 Ubuntu 上为 service ssh restart
)
更新:问题已于2017-04-29解决
我怀疑您需要为 JVM 安装 Java Cryptography Extension。 否则,RSA 密钥大小就会受到限制,并且无法建立身份验证。
请参阅 https://issues.jenkins-ci.org/browse/JENKINS-26495 了解更多详细信息。