git checkout failed with exception reference is not a tree

99 views
Skip to first unread message

Arunachalam Sibisakkaravarthi

unread,
Jun 12, 2020, 11:29:55 AM6/12/20
to jenkins...@googlegroups.com
Hi Guys
We use the PullRequest pipeline to trigger the dev branch where it happens often.
Still we are facing the same problem which resolved here https://issues.jenkins-ci.org/browse/JENKINS-45997

We enabled "Call can merge" configuration in Jenkins
Not sure about what is the problem, can you help to identify it.

Git: 2.27
Jenkins: 2.222.4
Bitbucket: 7.0.0

Thanks And Regards
Sibi.Arunachalam
mCruncher

Message has been deleted

Arunachalam Sibisakkaravarthi

unread,
Jun 14, 2020, 9:11:29 PM6/14/20
to Jenkins Users
This is actual exception thrown Pull Request pipeline. Please let me know if anyone needs more information.
 
git checkout -f 8e3b73d51abd3f0e77f7d1bf16dbdaa46b0f734e # timeout=10
ERROR: Checkout failed
hudson.plugins.git.GitException: Command "git checkout -f 8e3b73d51abd3f0e77f7d1bf16dbdaa46b0f734e" returned status code 128:
stdout: 
stderr: fatal: reference is not a tree: 8e3b73d51abd3f0e77f7d1bf16dbdaa46b0f734e

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$1100(CliGitAPIImpl.java:81)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2743)
Caused: hudson.plugins.git.GitException: Could not checkout 8e3b73d51abd3f0e77f7d1bf16dbdaa46b0f734e
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2767)
	at jenkins.plugins.git.MergeWithGitSCMExtension.checkout(MergeWithGitSCMExtension.java:144)
	at jenkins.plugins.git.MergeWithGitSCMExtension.decorateRevisionToBuild(MergeWithGitSCMExtension.java:110)
	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1063)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1168)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155)
	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:142)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:428)
Retrying after 10 seconds

Mark Waite

unread,
Jun 14, 2020, 11:36:59 PM6/14/20
to Jenkins Users
If you had received that stack trace and no other information, what would you have done?  How would you have investigated your report?  What steps would you have taken to clarify the problem and find an answer?

A stack trace is not enough information to provide helpful suggestions.

Refer to https://www.jenkins.io/participate/report-issue/ for the types of information that are needed so that others can help you.

Some examples in your specific case include:
  • What do you mean precisely when you say, "Pull Request pipeline"?  What is the definition of your Multibranch Pipeline and of the Jenkinsfile in this failure case?  Which branch source provider are you using (GitHub, Bitbucket, Gitea, GitlLab, Git)?
  • Does the commit "8e3b73d51abd3f0e77f7d1bf16dbdaa46b0f734e" exist in the source repository?  If not, does it exist in a pipeline shared library repository that you are using?
  • What steps did you execute to generate that message?
  • What alternate steps have you tried?
  • What were the results of those alternate steps?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.

Arunachalam Sibisakkaravarthi

unread,
Jun 15, 2020, 10:15:43 PM6/15/20
to Jenkins Users
Hi Mark, I share the information you requested.

      We have a BitBucket Webhook to notify Jenkins to build this Multibranch pipeline
       
        Answers for your questions:
  • We use BitBucket Branch Source plugin in our Multibranch pipeline
  • This commit is present in the project repository
  • When a single commit was pushed, we didn’t face this issue but when more than N commits were pushed, this problem occurred consistently
  • Enabled "Call can merge" option to solve the problem, but it didn't solve.
        Observations:
  • The pipeline failed during “checkout” itself with this error  
  • We found that the same commit was built successfully when the Multibranch pipeline was indexed and scanned.
  • However when that individual feature branch was built manually, the checkout failed.
Thanks Mark for reply. Please let me know if you need any information or clarification.
         



Mark Waite

unread,
Jun 15, 2020, 10:57:08 PM6/15/20
to Jenkins Users
On Mon, Jun 15, 2020 at 8:16 PM Arunachalam Sibisakkaravarthi <aruna...@mcruncher.com> wrote:
Hi Mark, I share the information you requested.

      We have a BitBucket Webhook to notify Jenkins to build this Multibranch pipeline
       
        Answers for your questions:
  • We use BitBucket Branch Source plugin in our Multibranch pipeline
  • This commit is present in the project repository
  • When a single commit was pushed, we didn’t face this issue but when more than N commits were pushed, this problem occurred consistently
A difference between one commit and many commits might be that the commit you mentioned by SHA1 is not the tip of the branch and you've configured your job to use git's "shallow clone" feature.  Since you didn't provide your job definition or the precise description of how the job is defined, that can only be a guess, but it might be one case where a commit is in the Bitbucket repository but is not in the workspace on the agent. 
  • Enabled "Call can merge" option to solve the problem, but it didn't solve.
        Observations:
  • The pipeline failed during “checkout” itself with this error  
  • We found that the same commit was built successfully when the Multibranch pipeline was indexed and scanned.
  • However when that individual feature branch was built manually, the checkout failed.
If the commit that is not being found is on a different branch than the working branch in the workspace and if the workspace was cloned with a narrow refspec that uses only a single branch, then git would optimize the fetch process and would only copy the specific branch.  If git copies only the specific branch, then the missing commit was not fetched because the narrow refspec specifically told git to only clone a single branch.

Cloning with a narrow refspec is more efficient than cloning with the default refspec.  Because of that, there are times when the Jenkins pipeline code chooses by default to clone a narrow refspec.  The narrow refspec reduces the load on the Bitbucket server and reduces disc use in the workspace.

The refspec used to populate the workspace should be in the log for the `checkout scm` call that was performed in your pipeline job.  

Arunachalam Sibisakkaravarthi

unread,
Jun 16, 2020, 4:11:59 AM6/16/20
to Jenkins Users
  • We checked already, the commit is actually tip of the branch
  • Our Multi-branch pipeline is not configured to use "shallow clone" feature
  • I shared complete console output here for better clarity
  • Attached our multibranch pipeline job configuration as well
multibranch_pipeline_Config_Jenkins_general.png
multibranch_pipeline_Config_Jenkins_build_configuration.png
multibranch_Jenkins_console_output.log

Arunachalam Sibisakkaravarthi

unread,
Jun 18, 2020, 8:39:02 PM6/18/20
to Jenkins Users
Hi guys, any idea to identify/solve the problem? Is there any mistakes in our Jenkins/BitBucket configuration?
Reply all
Reply to author
Forward
0 new messages