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

Gerrit Trigger v2.39.0 no longer triggers on "topic-changed" events

      We rely on the "topic-changed" Gerrit events to query Gerrit for patchsets with the same topic to checkout changes across different repos, and this appears to have stopped working in v2.39.0.

      Reverting back to v2.38.1 works again so it seems like a regression in the latest version.

      We have confirmed that we see the "topic-changed" events on the Gerrit server's event stream and the patch sets also appear in the "Query and Trigger Gerrit Patches" area when searching for the topic, so this is definitely plugin related.

      Using v2.39.0 we also tried enabling these settings, but it had no effect:

      • Build Current Patches Only
      • Abort manual patch sets
      • Abort patch sets with same topic
      • Vote patch sets with same topic

      Pushing new patchsets would still trigger changes, but they didn't populate the "GERRIT_TOPIC" parameter which is what we rely on for querying Gerrit for the linked patchsets.

      Reproduction steps:

      Repro Steps
      0. ensure gerrit trigger for the Jenkins job configured to trigger a build when the change is rebased.
      1.  create a change with a topic
      2. push the change
      3. edit the change and remove the topic
      4. rebase the change

      Expected:
      The gerrit plugin triggers a Jenkins build.

      mvn hpi:run with a breakpoint at line 194 of src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/RunningJobs.java

      should show the resulting NPE.

          [JENKINS-71328] Gerrit Trigger v2.39.0 no longer triggers on "topic-changed" events

          Poorly added a comment - - edited

          This issue is technically a duplicate of https://issues.jenkins.io/browse/JENKINS-61928, which is caused by the same underlying issue, namely:

          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/RunningJobs.java#shouldIgnoreEvent(...

          takes two events as arguments. These events can contain patchSet objects which are null. This assertion is based on the fact that I can step through the code and see a NPE generated at line 194. The NPE throws and causes the build to be aborted.

          The following comments address the code at this commit: 

          commit 2d5d90b48f75b24a50fd93fddfa7a6900fa98c1b (HEAD -> master, origin/master, origin/HEAD)

          Merge: 03929e1e c7e26beb

          The code accessing the event.patchSet at RunningJobs.java line 194:

          boolean shouldCancelPatchsetNumber = policy.isAbortNewPatchsets()
          || Integer.parseInt(runningChangeBasedEvent.getPatchSet().getNumber())
          < Integer.parseInt(event.getPatchSet().getNumber());

          Clearly does not take into account these values (runningChangeBasedEvent.getPatchSet() and event.getPatchSet()) can be null.

          Poorly added a comment - - edited This issue is technically a duplicate of https://issues.jenkins.io/browse/JENKINS-61928 , which is caused by the same underlying issue, namely: src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/RunningJobs.java#shouldIgnoreEvent(... )  takes two events as arguments. These events can contain patchSet objects which are null. This assertion is based on the fact that I can step through the code and see a NPE generated at line 194. The NPE throws and causes the build to be aborted. The following comments address the code at this commit:  commit 2d5d90b48f75b24a50fd93fddfa7a6900fa98c1b ( HEAD -> master , origin/master , origin/HEAD ) Merge: 03929e1e c7e26beb The code accessing the event.patchSet at RunningJobs.java line 194: boolean shouldCancelPatchsetNumber = policy.isAbortNewPatchsets() || Integer.parseInt(runningChangeBasedEvent.getPatchSet().getNumber()) < Integer.parseInt(event.getPatchSet().getNumber()); Clearly does not take into account these values ( runningChangeBasedEvent.getPatchSet() and event.getPatchSet())  can be null.

          Michael Nazzareno added a comment - Please try this pull request https://github.com/jenkinsci/gerrit-trigger-plugin/pull/504

          Jasper added a comment -

          Hi panicking, thank you for looking into this.

          There was actually already a fix included in v2.39.4 for this issue (many thanks to poorlydefined for that!) and I can confirm the 'topic-changed' events work as expected now. The Jira just wasn't updated.

          Jasper added a comment - Hi panicking , thank you for looking into this. There was actually already a fix included in v2.39.4 for this issue (many thanks to poorlydefined for that!) and I can confirm the 'topic-changed' events work as expected now. The Jira just wasn't updated.

          Jasper added a comment -

          Fixed

          Jasper added a comment - Fixed

          jaspjoyce I find out the topic build in general is broken

          Michael Nazzareno added a comment - jaspjoyce I find out the topic build in general is broken

          Jasper added a comment -

          More fixes are always appreciated, thanks  

          This particular Jira is solved at least now.

          Jasper added a comment - More fixes are always appreciated, thanks   This particular Jira is solved at least now.

            poorlydefined Poorly
            jaspjoyce Jasper
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: