Jenkins workflow-multibranch with git - IllegalSta

2019-09-08 03:42发布

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?

3条回答
孤傲高冷的网名
2楼-- · 2019-09-08 03:52

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楼-- · 2019-09-08 03:53

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

查看更多
贪生不怕死
4楼-- · 2019-09-08 04:05

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.

查看更多
登录 后发表回答