我已经创建了一个示例项目结构来测试Barchart Plugin。
-layout-project pom.xml
-parent-module pom.xml
-main-module pom.xml
-dependency-module pom.xml
从配置的git repo中检出布局和模块项目,并从布局项目中正确构建成员和级联项目。但是当我触发发布版本(在项目页面上选择“Cascade Release”操作并单击“Submit”)时,它会引发以下异常:
FATAL: org.eclipse.jgit.api.errors.TransportException: ssh://myusername@myhost/home/git/cascade-release.git: UnknownHostKey: myhost. RSA key fingerprint is 20:be:e9:3a:44:3d:cf:a8:24:00:e3:29:ab:7f:73:c5
com.jcraft.jsch.JSchException: UnknownHostKey: myhost. RSA key fingerprint is 20:be:e9:3a:44:3d:cf:a8:24:00:e3:29:ab:7f:73:c5
at com.jcraft.jsch.Session.checkHost(Session.java:805)
at com.jcraft.jsch.Session.connect(Session.java:345)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:117)
Caused: org.eclipse.jgit.errors.TransportException: ssh://myusername@myhost/home/git/cascade-release.git: UnknownHostKey: myhost. RSA key fingerprint is 20:be:e9:3a:44:3d:cf:a8:24:00:e3:29:ab:7f:73:c5
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:160)
at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:137)
at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:264)
at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:162)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1201)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128)
Caused: org.eclipse.jgit.api.errors.TransportException: ssh://myusername@myhost/home/git/cascade-release.git: UnknownHostKey: myhost. RSA key fingerprint is 20:be:e9:3a:44:3d:cf:a8:24:00:e3:29:ab:7f:73:c5
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:135)
at com.barchart.jenkins.cascade.PluginScmGit.doFetch(PluginScmGit.java:153)
Caused: java.lang.RuntimeException
at com.barchart.jenkins.cascade.PluginScmGit.doFetch(PluginScmGit.java:155)
at com.barchart.jenkins.cascade.PluginScm$2.invoke(PluginScm.java:246)
at com.barchart.jenkins.cascade.PluginScm$2.invoke(PluginScm.java:221)
at hudson.FilePath.act(FilePath.java:997)
at hudson.FilePath.act(FilePath.java:975)
at com.barchart.jenkins.cascade.PluginScm.scmCheckout(PluginScm.java:310)
at com.barchart.jenkins.cascade.CascadeLogic.process(CascadeLogic.java:346)
at com.barchart.jenkins.cascade.CascadeBuild$CascadeExecution.run(CascadeBuild.java:41)
at hudson.model.Run.execute(Run.java:1724)
at com.barchart.jenkins.cascade.CascadeBuild.run(CascadeBuild.java:70)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
我已经检查了目录known_hosts
中的<jenkins_home>/.ssh/
文件,它包含异常中提到的指纹。用户jenkins从命令行上的git repo中检出也没有任何问题。通过Maven Release Plugin发布时也不会发生这种情况。所以我猜它一定是插件特定的问题。也许错误配置!?
以下是我在服务器端看到的内容
Mar 7 18:33:03 myhost sshd[29240]:
error: Received disconnect from 192.168.0.9 port 46217:3: com.jcraft.jsch.JSchException:
UnknownHostKey: myhost. RSA key fingerprint is 20:be:e9:3a:44:3d:cf:a8:24:00:e3:29:ab:7f:73:c5 [preauth]
Mar 7 18:33:03 myhost sshd[29240]: Disconnected from 192.168.0.9 port 46217 [preauth]
任何帮助将不胜感激。
答案 0 :(得分:0)
问题解决后,known_hosts文件错过了远程主机(myhost)散列键的条目以及git用户的公钥。通过将条目添加到文件,我可以使用命令ssh-keygen -l -E md5 -f .ssh/known_hosts
验证它现在包含预期的指纹。