我确定我正在做一些你们大多数人都会嘲笑的愚蠢的事情,但我似乎无法让 Jenkins 使用多分支管道进行构建。我已经将问题简化为本质。具有空节点 JenkinsFile 的单个分支(主)。我有第二个项目,一个标准的 Freestyle 项目,基本上运行true
以验证它的构建。
这是我的自由式配置:
Repository URL: ssh://git@rgit.vegicorp.net:7999/dw/foobar.git
Credentials: None
BUILD
Execute Shell
Command: True
并且构建工作。(基本上,repo 签出、true
运行,并且构建报告为成功。
这是我的多分支构建配置:
BRANCH SOURCES
Project Repository: ssh://git@rgit.vegicorp.net:7999/dw/foobar.git
Credentials: None
BUILD CONFIGURATION
Mode: By JenkinsFile
当我进行分支索引时,我遇到了失败并且日志显示:
Started
Setting origin to ssh://git@cmstash.travelclick.net:7999/dw/foobar.git
Fetching origin...
FATAL: Failed to recompute children of test » Jenkinsfile Test \
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:678)
at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:174)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:146)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:294)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:157)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:122)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
我的 JenkinsFile(位于回购的根目录)说:
node {
}
当我不做多分支管道并将其作为 Jenkins 构建脚本放入时,这很有效。我只是想验证 Jenkins 是否能够获取我的 JenkinsFile。