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

Play-back Gerrit events which happened during a Jenkins downtime

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Use case: Jenkins become unavailable. In the meantime, there are a number of Gerrit events occurring which are missed. When Jenkins restarts, these missed events should be replayed.

      E.g. a designer submits a patch set during a Jenkins outage. Since Gerrit trigger is not firing, the patch will never be verified and merged, or will need to be done manually. There is a facility in Gerrit trigger to "manually" query events during a given period, but this will not scale as need to be done for each job.

      The requirement would be:

      1. It shall be possible to replay all "missing" Gerrit events for a given Jenkins master following a downtime of the master
      2. It shall be possible to have #1 trigger automatically i.e. that when Jenkins restart, all events that happened since last time it ran will be replayed.
      3. It shall be possible to trigger #1 manually. This capability shall be available only to the administrator role

      Limitations of current feature with regards to our requirement:

      • Only "patchset created" events are supported. Events such as "change merged," "comment added," or "ref updated" will be missed.
      • Gerrit projects specified via path or regular expression will be ignored.
      • If a user submits a review to a patchset during the downtime, the build will not be triggered because the feature only looks at unreviewed patchsets.
      • It is not possible to trigger this feature manually.

        Attachments

          Activity

          Hide
          rin_ne rin_ne added a comment -

          Such feature except #3 has been added since 2.11.0. See Changelog at 2.11.0-beta-1.

          Show
          rin_ne rin_ne added a comment - Such feature except #3 has been added since 2.11.0. See Changelog at 2.11.0-beta-1.
          Hide
          chris31421 Christian Lague added a comment -

          Great, did not noticed it. We will revisit our need for #3 and update this issue accordingly

          Show
          chris31421 Christian Lague added a comment - Great, did not noticed it. We will revisit our need for #3 and update this issue accordingly
          Hide
          eivebra Ivelin Bratanov added a comment -

          I'm not able to make this feature work with the latest release, version 2.11.1.
          I've ticked off the “Check non-reviewed patchsets” checkbox in the job.
          The builds are triggering fine while the connection between Jenkins and Gerrit is established, but no attempt is made to look for unreviewed patchsets in either of the following test cases:
          a) Shut down Jenkins, create a new patchset on Gerrit, and reboot from war file.
          b) Stop the connection from the server config page, create a new patchset on Gerrit, and start connection again.

          Any suggestions would be appreciated.

          Also, I've updated the issue description to include the limitations with regards to our requirement.

          Show
          eivebra Ivelin Bratanov added a comment - I'm not able to make this feature work with the latest release, version 2.11.1. I've ticked off the “Check non-reviewed patchsets” checkbox in the job. The builds are triggering fine while the connection between Jenkins and Gerrit is established, but no attempt is made to look for unreviewed patchsets in either of the following test cases: a) Shut down Jenkins, create a new patchset on Gerrit, and reboot from war file. b) Stop the connection from the server config page, create a new patchset on Gerrit, and start connection again. Any suggestions would be appreciated. Also, I've updated the issue description to include the limitations with regards to our requirement.
          Hide
          eivebra Ivelin Bratanov added a comment - - edited

          It seems that this feature is not functional in the latest release of GT, nor in the master.
          This is because the attempt to add the UnreviewedPatchesListener as a listener to the GerritConnection instance is ignored, causing the check for unreviewed patchsets to never occur. (In GerritServer.java)
          We've created a fix for this bug and will be contributing it shortly.

          Show
          eivebra Ivelin Bratanov added a comment - - edited It seems that this feature is not functional in the latest release of GT, nor in the master. This is because the attempt to add the UnreviewedPatchesListener as a listener to the GerritConnection instance is ignored, causing the check for unreviewed patchsets to never occur. (In GerritServer.java) We've created a fix for this bug and will be contributing it shortly.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Scott Hebert
          Path:
          .gitignore
          pom.xml
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer.java
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/EventTimeSlice.java
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsPlaybackManager.java
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/utils/GerritPluginChecker.java
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/utils/HttpUtils.java
          src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/message.jelly
          src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/message.properties
          src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/Messages.properties
          src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/LockedDownGerritEventTest.java
          src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/mock/Setup.java
          src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsFunctionalTest.java
          src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsLoadPersistTest.java
          src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsPlaybackManagerTest.java
          src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/utils/MockPluginCheckerConfig.java
          http://jenkins-ci.org/commit/gerrit-trigger-plugin/13b4cc27b892df390e3060de99304a87374a1b9d
          Log:
          Missed Events Playback on re-connect

          The missed events playback manager is now able to:

          • maintain a last known alive timestamp of events that were received by the
            Gerrit Server connection.
          • Upon re-connect, a request is made to the Gerrit Events-Log plugin installed on the Gerrit
            Server to determine which events may have been missed while the connection was down.
          • The events are then added to the Gerrit Trigger event queue to be processed.

          This feature is only enabled if:

          JENKINS-23871

          Change-Id: I1cfacad309885b88d23f8925d164a6aa427af764

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Scott Hebert Path: .gitignore pom.xml src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer.java src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/EventTimeSlice.java src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsPlaybackManager.java src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/utils/GerritPluginChecker.java src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/utils/HttpUtils.java src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/message.jelly src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/message.properties src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/Messages.properties src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/LockedDownGerritEventTest.java src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/mock/Setup.java src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsFunctionalTest.java src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsLoadPersistTest.java src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/playback/GerritMissedEventsPlaybackManagerTest.java src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/utils/MockPluginCheckerConfig.java http://jenkins-ci.org/commit/gerrit-trigger-plugin/13b4cc27b892df390e3060de99304a87374a1b9d Log: Missed Events Playback on re-connect The missed events playback manager is now able to: maintain a last known alive timestamp of events that were received by the Gerrit Server connection. Upon re-connect, a request is made to the Gerrit Events-Log plugin installed on the Gerrit Server to determine which events may have been missed while the connection was down. The events are then added to the Gerrit Trigger event queue to be processed. This feature is only enabled if: The REST api is configured. The Gerrit Events-log plugin is installed on the Gerrit Server Please see https://gerrit.googlesource.com/plugins/events-log/ JENKINS-23871 Change-Id: I1cfacad309885b88d23f8925d164a6aa427af764
          Hide
          scoheb Scott Hebert added a comment -

          Will be released as part of 2.14

          Show
          scoheb Scott Hebert added a comment - Will be released as part of 2.14

            People

            • Assignee:
              scoheb Scott Hebert
              Reporter:
              chris31421 Christian Lague
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: