3

I installed Rabbit MQ plugin for Gerrit and configured Gerrit to send stream events to Queue. I installed Gerrit Trigger plugin and Rabbit MQ consumer plugin in my Jenkins and created a test-job to trigger build based on Gerrit event.

Gerrit pushes the events to Rabbit MQ queue. Jenkin job is supposed to receive the gerrit events from Rabbit MQ queue and do a build for each event.

The problem is that Jenkin job (test-job) is triggered twice instead of once for each gerrit event and two builds happen for one event.

It seems one build is triggered due to gerrit event in Rabbit MQ queue and another build for same job is triggered due to gerrit event coming from configured gerrit server.

I tried to search internet but no solutions found.

I followed this tutorial.. https://docs.google.com/presentation/d/10n0A6BoyEVBsU4t-edW58Nq5kuefmcIZFBAssxxQoMU/htmlpresent

Gerrit trigger plugin configuration in Jekin

// Not complete config

 <name>local-gerrit</name>
<gerritHostName>10.xxx.yy.zz</gerritHostName>
<gerritSshPort>29418</gerritSshPort>
<gerritFrontEndUrl>http://10.xxx.yy.zz:8010/</gerritFrontEndUrl>

Rabbit MQ consumer plugin configuration Jenkin

<?xml version='1.0' encoding='UTF-8'?>
<org.jenkinsci.plugins.rabbitmqconsumer.GlobalRabbitmqConfiguration plugin="rabbitmq-consumer@2.7">
  <urlValidator>
    <options>8</options>
    <allowedSchemes>
      <string>amqp</string>
      <string>amqps</string>
    </allowedSchemes>
  </urlValidator>
  <enableConsumer>true</enableConsumer>
  <serviceUri>amqp://10.xxx.yy.zz</serviceUri>
  <userName>guest</userName>
  <userPassword></userPassword>
  <watchdogPeriod>60000</watchdogPeriod>
  <consumeItems>
    <org.jenkinsci.plugins.rabbitmqconsumer.RabbitmqConsumeItem>
      <appId>gerrit</appId>
      <queueName>jenkin-queue</queueName>
    </org.jenkinsci.plugins.rabbitmqconsumer.RabbitmqConsumeItem>
  </consumeItems>
  <enableDebug>false</enableDebug>
</org.jenkinsci.plugins.rabbitmqconsumer.GlobalRabbitmqConfiguration>

Any help on this is appreciated. Thanks in advance.

sai
  • 31
  • 1

1 Answers1

0

It might be because of Gerrit Hook which may trigger your Jenkins job remotely.(if you have configurations in gerrit hook)

  • I don't understand this. please tell me where can i check gerrit hook configuration and how to disable that. Any links on this will really be helpful. – sai Jul 13 '16 at 03:03
  • Complete gerrit hook info is here https://git.eclipse.org/r/Documentation/config-hooks.html – Anand Jumnani Jul 13 '16 at 13:51