Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49349

git scm plugin attempts to checkout stale SHAs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins 2.89.3
      Git SCM 3.7.0
      ghpr-builder 1.40.0

      We have a few jobs whos git repos have branches created and PRs raised against multiple upstream branches, frequently. All forks and upstream repos are accessible to the Jenkins instance(s). Our configuration uses origin/* as the branch specifier because the job needs to be able to build all pull-requests that are raised against the upstream repo. Once in a while, a job would fail with this message:

      17:05:09 hudson.plugins.git.GitException: Command "git checkout -f 263ff49cc123ede2429569ed22b6c22bfab89450" returned status code 128:
      17:05:09 stdout: 
      17:05:09 stderr: fatal: reference is not a tree: 263ff49cc123ede2429569ed22b6c22bfab89450
      17:05:09 
      17:05:09 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1990)
      17:05:09 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$800(CliGitAPIImpl.java:72)
      17:05:09 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2289)
      17:05:09 Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from ip-x-x-x-x.us-west-2.compute.internal/x.x.x.x:49650
      17:05:09 		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1693)
      17:05:09 		at hudson.remoting.UserResponse.retrieve(UserRequest.java:310)
      17:05:09 		at hudson.remoting.Channel.call(Channel.java:908)
      17:05:09 		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
      17:05:09 		at sun.reflect.GeneratedMethodAccessor332.invoke(Unknown Source)
      17:05:09 		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      17:05:09 		at java.lang.reflect.Method.invoke(Method.java:498)
      17:05:09 		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
      17:05:09 		at com.sun.proxy.$Proxy75.execute(Unknown Source)
      17:05:09 		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1210)
      17:05:09 		at hudson.scm.SCM.checkout(SCM.java:495)
      17:05:09 		at hudson.model.AbstractProject.checkout(AbstractProject.java:1202)
      17:05:09 		at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
      17:05:09 		at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      17:05:09 		at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
      17:05:09 		at hudson.model.Run.execute(Run.java:1724)
      17:05:09 		at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      17:05:09 		at hudson.model.ResourceController.execute(ResourceController.java:97)
      17:05:09 		at hudson.model.Executor.run(Executor.java:421)
      17:05:09 Caused: hudson.plugins.git.GitException: Could not checkout 263ff49cc123ede2429569ed22b6c22bfab89450
      17:05:09 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2313)
      17:05:09 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
      17:05:09 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
      17:05:09 	at hudson.remoting.UserRequest.perform(UserRequest.java:207)
      17:05:09 	at hudson.remoting.UserRequest.perform(UserRequest.java:53)
      17:05:09 	at hudson.remoting.Request$2.run(Request.java:358)
      17:05:09 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      17:05:09 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      17:05:09 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      17:05:09 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      17:05:09 	at hudson.remoting.Engine$1$1.run(Engine.java:98)
      17:05:09 	at java.lang.Thread.run(Thread.java:748)
      

      Upon investigation, the SHA that Jenkins was attempting to check out was either in a branch of a PR, or just a branch that was deleted, or a commit in a separate fork.

      The issue overall seems to be that the SCM plugin is trying to checkout SHAs that are not in the origin remote (i.e.: the upstream repo) and instead the SHA of some other fork. This is strange since the branch specifier is origin/, not */*

            Unassigned Unassigned
            chr0n1x Kevin R.
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: