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

NPE on git polling with gerrit-trigger

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • gerrit-trigger-plugin
    • Jenkins 2.70, Gerrit Trigger 2.24, git plugin 3.4.1, git client plugin 2.4.6

      Hi, everyone!

      I have and issue with Jenkins and gerrit trigger plugin. I created a git project and would like to build it after creation of patch set on gerrit. But when does jenkins poll a changes from gerrit, as exception happens. Git polling log is attached:

       

      Started on Jul 26, 2017 6:52:00 PM
      Polling SCM changes on master
      Using strategy: Gerrit Trigger
      [poll] Last Built Revision: Revision 140ee3a440f1d3646ae1427cff492160aafbeefc (origin/branch-1)
       > git.exe rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > git.exe config remote.origin.url ssh://some-valid-url/project.git # timeout=10
      Fetching upstream changes from ssh://some-valid-url/project.git
       > git.exe --version # timeout=10
      using GIT_SSH to set credentials 
       > git.exe fetch --tags --progress ssh://some-valid-url/project.git refs/changes/*:refs/changes/*
      Polling for changes in
      ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@e2ce63c[Project]
      java.lang.NullPointerException
      	at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser$GetGerritEventRevision.invoke(GerritTriggerBuildChooser.java:270)
      	at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser$GetGerritEventRevision.invoke(GerritTriggerBuildChooser.java:265)
      	at hudson.plugins.git.GitSCM$BuildChooserContextImpl.actOnBuild(GitSCM.java:921)
      	at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser.getCandidateRevisions(GerritTriggerBuildChooser.java:112)
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:713)
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:592)
      	at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:391)
      	at hudson.scm.SCM.poll(SCM.java:408)
      	at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1416)
      	at hudson.model.AbstractProject._poll(AbstractProject.java:1386)
      	at hudson.model.AbstractProject.poll(AbstractProject.java:1297)
      	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:594)
      	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:640)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:748)
      

       

      NPE happens in gerrit-trigger plugin here: 

      com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser.GetGerritEventRevision#invoke

      , build is null here.

       Build variable is passed to this function from 

      hudson.plugins.git.GitSCM#compareRemoteRevisionWithImpl

      line 601 where it is really null:

      Collection<Revision> candidates = getBuildChooser().getCandidateRevisions(
       true, singleBranch, git, listener, buildData, new BuildChooserContextImpl(project, null, environment));

      Do you have any workaround for it? Or on which version of gerrit/git/jenkins does it work correctly?

            rsandell rsandell
            abarmin Aleksandr Barmin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: