fokadw
Last Updated: August 20, 2016
·
926
· superboum
Avatar1

Jenkins multibranch project indexing finished with status "Not Built"

Sometimes when you run the branch indexing of your multibranch pipeline it says Finished: NOT BUILT instead of Finished: SUCCESS.
And your branch are not detected.

Indeed, this message means that there was an error that Jenkins has hidden in its interface. But you can find it in your log files, especially in the file jenkins.err.log located in your JENKINS_HOME folder by default. There is a ton of reason why the branch indexing failed. Here is the log of my error:

Jul 28, 2016 2:22:06 PM hudson.model.Executor finish1
SEVERE: Executor threw an exception
java.lang.NoSuchMethodError: org.eclipse.jgit.treewalk.TreeWalk.release()V
    at jenkins.plugins.git.AbstractGitSCMSource$1.exists(AbstractGitSCMSource.java:254)
    at org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory$1.isHead(WorkflowBranchProjectFactory.java:51)
    at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:259)
    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:404)

In my case, it was linked with JGit. As you might not know, but even if you setup Jenkins to use the official implementation of git, the multibranch pipeline plugin will use JGit for the branch indexing. The JGit implementation is required by the git-client-plugin, which is required by the git-plugin. These 2 plugins have different roles. git-client-plugin is a wrapper around different git implementation and expose a high level API to use git. git-plugin is the plugin you will use in Jenkins, and will use git-client-plugin to interact with git. I had the following error because I tried a beta version of git-client-plugin which had probably some breaking changes with the actual version of git-plugin.

TL;DR

I've solved my problem by downgrading git-client-plugin and restarting Jenkins.

Say Thanks
Respond