Jenkins工作流程 - 使用git的多分支 - IllegalStateException

时间:2015-12-16 16:48:45

标签: jenkins jenkins-workflow

我正在尝试使用带有git的Jenkins的workflow-multibranch插件创建一个多分支作业。在尝试索引分支时,在正常工作流作业中正常工作的凭据会在multibranch作业中产生以下错误:

    Started
Setting origin to git@github.com:XXXXX/XXXXXXX.git
Fetching origin...
FATAL: Failed to recompute children of Branch Indexing
java.lang.IllegalStateException: Cannot open session, connection is not authenticated.
    at com.trilead.ssh2.Connection.openSession(Connection.java:1127)
    at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:32)
    at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
    at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
    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:1138)
    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
    at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:672)
    at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:171)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:141)
    at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:295)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:151)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:106)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

我最新的插件,虽然Jenkins本身是1.636,最新的是1.642。

我有什么遗失的吗?

3 个答案:

答案 0 :(得分:1)

听起来像是Git插件中的一个错误,但无论如何都要安装GitHub Branch Source插件,它比通用连接更好。

答案 1 :(得分:0)

这是一个错误,请参阅https://issues.jenkins-ci.org/browse/JENKINS-33983

我在那里提到的解决方法是进入“管理Jenkins” - &gt; “全局工具配置”然后在“Git”下单击“添加Git”,然后选择“JGit”。另请参阅https://wiki.jenkins-ci.org/display/JENKINS/Git+plugin+2.0+beta+testing#Gitplugin2.0betatesting-ActivatingJGit

答案 2 :(得分:0)

想要补充一点,我还必须进入Global Credentials并添加一个指向您的ssh授权文件的条目。然后在你的工作中从Git配置中引用这个键。