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

Gerrit Trigger "Abort Patchsets with Same Topic" is broken

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • gerrit-trigger-plugin
    • None
    • Jenkins 2.89.4
      Gerrit Trigger plugin 2.27.5

    Description

      I want to abort a build if a new patchset is added to a change (usually in a different repo/project) with the same topic name. This appears to be exactly the point of the feature which was added in https://github.com/jenkinsci/gerrit-trigger-plugin/pull/326

      However, enabling "Abort patch sets with same topic" isn't actually aborting old builds.

      Setup (on a clean Jenkins installation with no extraneous plugins or jobs)

      1. Create a job triggered by the Patchset Created Gerrit event, with at least two different projects
      2. Upload a change for review in project1 and project2 on Gerrit. Set them to have the same Topic (ignore the first round of builds; let them finish or abort manually)
      3. Push a new patchset to the project1 change
      4. Push a new patchset to the project2 change

      Expected Result:

      • Step 3 should start a new build
      • Step 4 should start a new build and abort the build from Step 3

      Actual Result:

      • The old build is not aborted in Step 4

      I did some debugging on this today and think I already found the problem: https://github.com/jenkinsci/gerrit-trigger-plugin/blob/gerrit-trigger-2.27.5/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java#L2287

      In RunningJobs.scheduled() there's an extra if (!shouldCancelPatchsetNumber) block right after  the if (!abortBecauseOfTopic && !shouldCancelPatchsetNumber). The result is that abortBecauseOfTopic essentially gets ignore.

      If I remove those 3 lines, then the feature works as I'd expect. The offending code was added in "Fix the deadlock in RunningJobs". My guess is that it was introduced accidentally as part of merge conflict resolution.

      Attachments

        Activity

          aswild Allen Wild created issue -
          aswild Allen Wild made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]

          People

            rsandell rsandell
            aswild Allen Wild
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: