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

Git plugin fails with NPE (Jenkins 1.502, 1.503)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Debian
    • Similar Issues:

      Description

      Git plugin fails with NPE after upgrade to Jenkins 1.502 / Git Plugin 1.2.0.
      This could not be solved by upgrading to 1.503.

      Started by user ****
      Building remotely on **** in workspace ****
      Checkout:**** / **** - hudson.remoting.Channel@d5ba3a:****
      Using strategy: Default
      FATAL: null
      java.lang.NullPointerException
      	at hudson.plugins.git.GitSCM.getGitExe(GitSCM.java:839)
      	at hudson.plugins.git.GitSCM.getGitExe(GitSCM.java:829)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1100)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1342)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:683)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:588)
      	at hudson.model.Run.execute(Run.java:1567)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:237)
      

      I tried with older versions of git plugin:

      Git Plugin version Cause Code
      1.2.0 NPE GitSCM.java:839
      1.1.29 IllegalAccessError GitSCM.java:940
      1.1.27 ClassCastException GitSCM.java:1370
      1.1.26 NPE GitSCM.java:875
      1.1.25 NPE GitSCM.java:867
      1.1.24 NPE GitSCM.java:871
      1.1.23 NPE GitSCM.java:993
      1.1.22 NPE GitSCM.java:935

      https://github.com/jenkinsci/git-plugin/blob/git-1.2.0/src/main/java/hudson/plugins/git/GitSCM.java#L839

      I'm not yet tried to attach any debugger, but it looks like Jenkins returns no git tool installations to the plugin.
      Configuration seems correct, at least same setting worked with previous Jenkins 1.498 / git plugin 1.1.25.

      <?xml version='1.0' encoding='UTF-8'?>
      <hudson.plugins.git.GitTool_-DescriptorImpl plugin="git-client@1.0.3">
        <installations class="hudson.plugins.git.GitTool-array">
          <hudson.plugins.git.GitTool>
            <name>Default</name>
            <home>/usr/bin/git</home>
          </hudson.plugins.git.GitTool>
        </installations>
      </hudson.plugins.git.GitTool_-DescriptorImpl>
      

        Attachments

          Activity

          Hide
          next2you Christian van der Leeden added a comment - - edited

          Same problem here, NPE when trying to clone the repo with Git Plugin 1.2 and Hudson 1.504

          Show
          next2you Christian van der Leeden added a comment - - edited Same problem here, NPE when trying to clone the repo with Git Plugin 1.2 and Hudson 1.504
          Hide
          next2you Christian van der Leeden added a comment -

          These steps did solve my problem:

          • uninstall git client plugin
          • restart
          • install git plugin (not client, will be installed along with git)
          • In configure System (Manage Jenkins) add the git executable and name it Default
          • The name (Default) is referenced in the config.xml of the job in: <gitTool>Default</gitTool>

          Previously my name was "Git" in the System configuration, changing it back to "Default" solved my NPE. The <scm class="hudson.plugins.git.GitSCM" plugin="git@1.1.26"> didn't make any difference. You can also try it via the Jenkins UI: configure the project, open all advanced tabs under git and reselect the Git Configuration (a pop up). After saving the config.xml will read: <scm class="hudson.plugins.git.GitSCM" plugin="git@1.2.0">

          Show
          next2you Christian van der Leeden added a comment - These steps did solve my problem: uninstall git client plugin restart install git plugin (not client, will be installed along with git) In configure System (Manage Jenkins) add the git executable and name it Default The name (Default) is referenced in the config.xml of the job in: <gitTool>Default</gitTool> Previously my name was "Git" in the System configuration, changing it back to "Default" solved my NPE. The <scm class="hudson.plugins.git.GitSCM" plugin="git@1.1.26"> didn't make any difference. You can also try it via the Jenkins UI: configure the project, open all advanced tabs under git and reselect the Git Configuration (a pop up). After saving the config.xml will read: <scm class="hudson.plugins.git.GitSCM" plugin="git@1.2.0">
          Hide
          jglick Jesse Glick added a comment -

          resolveGitTool() returning null.

          Show
          jglick Jesse Glick added a comment - resolveGitTool() returning null.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          http://jenkins-ci.org/commit/git-plugin/e8f9d4c113cebdb058ecadfe9b2710fba1f47c0f
          Log:
          JENKINS-17013 preventive workaround to NullPointerException
          select default installation when none is matching

          Compare: https://github.com/jenkinsci/git-plugin/compare/9625801c1859...e8f9d4c113ce


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/e8f9d4c113cebdb058ecadfe9b2710fba1f47c0f Log: JENKINS-17013 preventive workaround to NullPointerException select default installation when none is matching Compare: https://github.com/jenkinsci/git-plugin/compare/9625801c1859...e8f9d4c113ce – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          pom.xml
          src/main/java/hudson/plugins/git/GitSCM.java
          http://jenkins-ci.org/commit/git-plugin/d2e7c1f7c0c91922f37429aea9e79c6ab142a40d
          Log:
          JENKINS-17013 NullPointerException when no "Default" GitTool installation is set

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: pom.xml src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/d2e7c1f7c0c91922f37429aea9e79c6ab142a40d Log: JENKINS-17013 NullPointerException when no "Default" GitTool installation is set
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          http://jenkins-ci.org/commit/git-plugin/9ed0f0ba7969da27609e211e5e6368722534de8d
          Log:
          JENKINS-17013 use default git installation if none matches


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/9ed0f0ba7969da27609e211e5e6368722534de8d Log: JENKINS-17013 use default git installation if none matches – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .
          Hide
          ndeloof Nicolas De Loof added a comment -

          git-client 1.0.4 + git 1.3.0 includes a workaround trying to address this issue

          Show
          ndeloof Nicolas De Loof added a comment - git-client 1.0.4 + git 1.3.0 includes a workaround trying to address this issue

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              okazaki Takayuki Okazaki
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: