Jenkins workflow-multibranch with git - IllegalStateException

谁说我不能喝 提交于 2019-12-11 23:18:49

问题


I'm trying to create a multibranch job using the workflow-multibranch plugin to Jenkins with git. The credentials that work fine in a normal workflow job produces the following errors in the multibranch job when trying to index the branches:

    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

I'm up to date on plugins, although Jenkins itself is at 1.636 where the latest is 1.642.

Is there something I'm missing?


回答1:


Sounds like a bug in the Git plugin, but anyway install the GitHub Branch Source plugin which will work better than a generic connection.




回答2:


It is a bug, see https://issues.jenkins-ci.org/browse/JENKINS-33983.

The workaround, which I mentioned there, is to go into "Manage Jenkins" -> "Global Tool Configuration" then under "Git" click "Add Git" then select "JGit". See also https://wiki.jenkins-ci.org/display/JENKINS/Git+plugin+2.0+beta+testing#Gitplugin2.0betatesting-ActivatingJGit.




回答3:


Wanted to add that I also had to go into the Global Credentials and add a entry which points to your ssh authorization file. Then reference this key from the Git config on your job.



来源:https://stackoverflow.com/questions/34317581/jenkins-workflow-multibranch-with-git-illegalstateexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!