Gerrit often sends a lot of emails, especially if you take part in many projects. For a while we felt that sometimes it's hard to notice the most important ones, like reviewers' and Sputnik's comments on our changes. We use Rocket.Chat for text communication inside the company and most of us are connected throughout the day, so we thought it might be useful to get chat message notification every time a comment is added on one's changes.
Gerrit has a built-in mechanism for running hooks - scripts that are called whenever a specific event occurs. The script must be named the same as the hook. We created a bash script named comment-added
, which is run every time someone adds a comment. Gerrit provides it with a lot of useful parameters, like project name, comment author, score, change owner, etc. Full documentation can be found here. After parsing