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

Git checkout fails in some projects

    XMLWordPrintable

Details

    Description

      Since on of our recent updates of the jenkins LTS version and all available plugins, git checkout sometimes fail with the following exception:

      FATAL: Could not checkout master with start point 94f70933316a337a21037ad791f6015ce7d561e5
      hudson.plugins.git.GitException: Could not checkout master with start point 94f70933316a337a21037ad791f6015ce7d561e5
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkoutBranch(CliGitAPIImpl.java:1090)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:326)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.plugins.git.GitException: Result has multiple lines
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.firstLine(CliGitAPIImpl.java:422)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:354)
      at hudson.plugins.git.GitAPI.revParse(GitAPI.java:255)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.parseBranches(CliGitAPIImpl.java:1024)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getBranches(CliGitAPIImpl.java:1035)
      at hudson.plugins.git.GitAPI.getBranches(GitAPI.java:153)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkoutBranch(CliGitAPIImpl.java:1081)
      ... 16 more

      So ar this only happens in multi-configuration projects where we merge cchanges from a branch taht triggered the job back to the master branch. The error seems to occur randomly on one of the configurations, but not on the master job itself.

      Attachments

        Activity

          owood Owen Wood added a comment -

          markewaite

          Can you provide the repository which has that problem, and the command line git version that has the problem?

          Unfortunately no as it's a customers.

          Is it specific to a particular repository?

          I have only been reported two cases and they were both from the same repository.

          Is it specific to a particular version of git?

          So here are all the versions:

          • git-client : 1.19.2
          • git-plugin : 2.4.1
          • git : 2.4.1

          Is it specific to a particular type of commit, or a particular naming pattern for the commit?

          I haven't seem anything obvious from the 2 cases where we have seen this occur so far.

          owood Owen Wood added a comment - markewaite Can you provide the repository which has that problem, and the command line git version that has the problem? Unfortunately no as it's a customers. Is it specific to a particular repository? I have only been reported two cases and they were both from the same repository. Is it specific to a particular version of git? So here are all the versions: git-client : 1.19.2 git-plugin : 2.4.1 git : 2.4.1 Is it specific to a particular type of commit, or a particular naming pattern for the commit? I haven't seem anything obvious from the 2 cases where we have seen this occur so far.
          markewaite Mark Waite added a comment - - edited

          Would it be enough to trim the rev-parse result?

          Something like applying a

          replaceAll("\\s{2,}", " ")
          

          to the string if it is detected that it has multiple lines?

          markewaite Mark Waite added a comment - - edited Would it be enough to trim the rev-parse result? Something like applying a replaceAll("\\s{2,}", " ") to the string if it is detected that it has multiple lines?
          owood Owen Wood added a comment -

          markewaite

          Here is a PR that basically looks for the first non blank line in the results and returns it or else null - https://github.com/jenkinsci/git-client-plugin/pull/199

          owood Owen Wood added a comment - markewaite Here is a PR that basically looks for the first non blank line in the results and returns it or else null - https://github.com/jenkinsci/git-client-plugin/pull/199

          Code changed in jenkins
          User: Evildethow
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
          http://jenkins-ci.org/commit/git-client-plugin/a9f57aa55e42f7af7ebced7bc73a336582bcdded
          Log:
          JENKINS-20991 - Sanitize rev-parse output with trimToNull()

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Evildethow Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/a9f57aa55e42f7af7ebced7bc73a336582bcdded Log: JENKINS-20991 - Sanitize rev-parse output with trimToNull()
          markewaite Mark Waite added a comment -

          Change included in git client plugin 1.19.6, released 6 Mar 2016

          markewaite Mark Waite added a comment - Change included in git client plugin 1.19.6, released 6 Mar 2016

          People

            owood Owen Wood
            languitar Johannes Wienke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: