Setting IRC gerrit bot for LibreOffice project

LibreOffice project is migrating currently to gerrit code review system. While gerrit provides mail channel out of the box, to install IRC gerrit bot to get notified on all or some gerrit events you are on your own. Thankfully OpenStack project comes to rescue, they have created and extracted simple yet very powerful multi project and multi channel gerritbot. It has 3 prerequisites:

  • python-daemon
  • python-yaml
  • irc

To be configured it needs two files: one for gerrit and IRC configuration and one for mapping of multiple IRC channels to gerrit events. Sample for gerritbot.cfg file:


[ircbot]
nick=myIRCgerritBot
pass=
server=irc.freenode.net
port=6667
channel_config=/home/gerrit2/bot/channel.yaml

[gerrit]
user=gerritbot
key=/home/gerrit2/.ssh/id_rsa
host=gerrit.libreoffice.org
port=29418

gerritbot.channel.yaml:


libreoffice-dev:
events:
- patchset-created
- change-merged
projects:
- dev-tools
branches:
- master

libreoffice-infra:
events:
- patchset-created
- change-merged
projects:
- dev-tools
branches:
- master

As you can see, we have configured two different channels and mapped the same gerrit events to both. To start you can use gerritbot.init file or just start it as a daemon from the command line with the gerritbot.cfg as argument. Note: if daemon is not started (lock file is not created) then you may experience some configuration problem. While gerritbot still doesn’t provides a logging machinery (why wouldn’t you provide a patch for that?) it might be manipulated to comment out daemonization and run it as a script. Just comment out four lines and call _main() directly. Now you must see configuration problems.

Another problem may occur with IRC channel. These one can be tracked down with irclib. Just turn on DEBUG=1 in irclib.py on your system and irclib would be very verbose and would tell you the whole truth.

Every time someone upload or commenting something on gerrit IRC bot would say something like that:


logerritbot David Ostrovsky proposed a change to dev-tools: add configuration files for IRC gerrit bot  https://gerrit.libreoffice.org/327

Responses are currently closed, but you can trackback from your own site.

Comments are closed.