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

Git checkout NullPointerException if no userRemoteConfig is provided (4.4.0)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-plugin
    • None
    • git-plugin 4.4.0
    • git plugin 4.4.3

      Some of our builds started to fail during a checkout step with the following error:

      java.lang.NullPointerException
      	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:852)
      	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:833)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1240)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Finished: FAILURE
      

      The code, that used to work in the past, was configured (for some reasons) as follow:

          stage("Checkout branch") {
              checkout scm
              // Specific configuration to clone the branch into a dedicated local branch.
              checkout([$class    : 'GitSCM',
                        branches  : [[name: "*/${env.BRANCH_NAME}"]],
                        extensions: [[$class: 'LocalBranch', localBranch: env.BRANCH_NAME]]
              ])
          }
      

      It looks like this was introduced by a recent change in https://github.com/jenkinsci/git-plugin/pull/931, specifically in the following changeset: if getUserRemoteConfigs() doesn't return any "user remote config", then chooser stays null and the call to chooser.getGitTool() fails with a NullPointerException.

            markewaite Mark Waite
            multani Jonathan Ballet
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: