git checkout failed with exception reference is not a tree

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

git checkout failed with exception reference is not a tree

Arunachalam Sibisakkaravarthi
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAAok04hbXkiHTRXPiXgrmYbvUfX16Fh4mkbzdG%2Bp_T0ajbe3Uw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Arunachalam Sibisakkaravarthi
 This is actual exception thrown in Pull Request Pipeline
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/be07037e-6f57-4b9a-bdc6-5bcf6c85018eo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Arunachalam Sibisakkaravarthi
In reply to this post by Arunachalam Sibisakkaravarthi
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Mark Waite-2
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?

On Sun, Jun 14, 2020 at 7:11 PM Arunachalam Sibisakkaravarthi <[hidden email]> wrote:
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFRVKFFxCHEfPAutL3U6B80uvmEra2EECW8T8fzuK_AQw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Arunachalam Sibisakkaravarthi
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.
         



On Monday, June 15, 2020 at 11:36:59 AM UTC+8 Mark Waite wrote:
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?

On Sun, Jun 14, 2020 at 7:11 PM Arunachalam Sibisakkaravarthi <[hidden email]> wrote:
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f21939ce-29d3-4ac8-b00b-64531c6057b3n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Mark Waite-2


On Mon, Jun 15, 2020 at 8:16 PM Arunachalam Sibisakkaravarthi <[hidden email]> 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.  
Thanks Mark for reply. Please let me know if you need any information or clarification.
         



On Monday, June 15, 2020 at 11:36:59 AM UTC+8 Mark Waite wrote:
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?

On Sun, Jun 14, 2020 at 7:11 PM Arunachalam Sibisakkaravarthi <[hidden email]> wrote:
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f21939ce-29d3-4ac8-b00b-64531c6057b3n%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHZXx4QsRk847c%2BuzvNL806eREcLMf-3YnbhfwHFxr_aw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Arunachalam Sibisakkaravarthi
  • 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


        




On Tuesday, June 16, 2020 at 10:57:08 AM UTC+8 Mark Waite wrote:
On Mon, Jun 15, 2020 at 8:16 PM Arunachalam Sibisakkaravarthi <[hidden email]> 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.  
Thanks Mark for reply. Please let me know if you need any information or clarification.
         



On Monday, June 15, 2020 at 11:36:59 AM UTC+8 Mark Waite wrote:
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?

On Sun, Jun 14, 2020 at 7:11 PM Arunachalam Sibisakkaravarthi <[hidden email]> wrote:
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.

--
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 [hidden email].

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/55dab1ad-71ad-44ca-baa0-e97851d7cae7n%40googlegroups.com.

multibranch_pipeline_Config_Jenkins_general.png (722K) Download Attachment
multibranch_pipeline_Config_Jenkins_build_configuration.png (673K) Download Attachment
multibranch_Jenkins_console_output.log (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: git checkout failed with exception reference is not a tree

Arunachalam Sibisakkaravarthi
Hi guys, any idea to identify/solve the problem? Is there any mistakes in our Jenkins/BitBucket configuration?

On Tuesday, June 16, 2020 at 4:11:59 PM UTC+8 Arunachalam Sibisakkaravarthi wrote:
  • 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


        




On Tuesday, June 16, 2020 at 10:57:08 AM UTC+8 Mark Waite wrote:
On Mon, Jun 15, 2020 at 8:16 PM Arunachalam Sibisakkaravarthi <[hidden email]> 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.  
Thanks Mark for reply. Please let me know if you need any information or clarification.
         



On Monday, June 15, 2020 at 11:36:59 AM UTC+8 Mark Waite wrote:
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?

On Sun, Jun 14, 2020 at 7:11 PM Arunachalam Sibisakkaravarthi <[hidden email]> wrote:
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ec7c0f7-2d45-4352-ac9e-85b6ce3bba19o%40googlegroups.com.

--
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 [hidden email].

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9a4bb732-419c-4840-8e71-67a38d6687fdn%40googlegroups.com.