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

Gerrit Verified Commands ignored when RestAPI is enabled

      Took me a lot of time to figure it out... But it seems like the commands specified in "Gerrit Verified Commands" are ignored if RestAPI is enabled.

      The RestAPI has two functions:

      1. Event "Missed Events Playback" - I thought this is the only one.
      2. Review comments.

      If I read the code correctly, yhere is no way to distinguish between the two as far as I read the code:

      NotificationFactory::queueBuildStarted
      if (config.isUseRestApi() && event instanceof ChangeBasedEvent) {
      
      NotificationFactory::queueBuildCompleted
      if (config.isUseRestApi()
              && memoryImprint.getEvent() instanceof ChangeBasedEvent) 

       

      I guess there should be a switch in configuration if to use the "Verified Commands" via RestAPI or not, so that both "Missed Events Playback" and the "Verified Commands" can work.

      Currently I disabled the RestAPI as it is more important to have a custom command that sets a custom label.

          [JENKINS-47420] Gerrit Verified Commands ignored when RestAPI is enabled

          I had the same problem, I was searching everywhere to find why it was not voting when the build start as some users was bypassing the Jenkins check due to it's only voting in the end of the build, what takes some time and I can't enable the Gerrit default vote as some projects doesn't have a job on Jenkins to vote +1 if the build is okay.

          As soon as I found this ticket, I disabled the REST API and it started to vote on build start.

          Renato Costallat added a comment - I had the same problem, I was searching everywhere to find why it was not voting when the build start as some users was bypassing the Jenkins check due to it's only voting in the end of the build, what takes some time and I can't enable the Gerrit default vote as some projects doesn't have a job on Jenkins to vote +1 if the build is okay. As soon as I found this ticket, I disabled the REST API and it started to vote on build start.

          ch liang added a comment -

          We're having the same issue when enabled REST API, and the requst body in BuildStartedRestCommand seems lack of verify or code-review labels:

          Expected:

          ch liang added a comment - We're having the same issue when enabled REST API, and the requst body in BuildStartedRestCommand seems lack of verify or code-review labels: Expected:

            rsandell rsandell
            alonbl Alon Bar-Lev
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: