openSUSE:Hermes OBS

Jump to: navigation, search


This page explains the customizations Hermes has to work with the Open Build Server


If you need further assistance (and you probably will ;-) do not hesitate to ask in IRC on freenode in the boosters channel #opensuse-boosters.

Customizations

Hermes is a generic tool that is not bound nor specific to the Open Build Service. It can be used easily in other environments. As it get notifications via HTTP interface through herminator it is easy to connect.

To do domain specific spice up of the messages Hermes is sending, there is a customization module in Hermes. The default Hermes comes with a customization module for the OBS (which is described here) but it should be straightforward to create a specific customization module for other systems.

There are some hucks in the Hermes code where customization are called. To make that work, copy the CustomizeStub.pm module from Hermes and implement the stub methods.

Here is what the documentation of the CustomizeStub says about:

This package can be changed to customize the behaviour of Hermes and 
influence its decisions on who will get a message based on the parameters. 
Currently Hermes calls two interface functions in the Customize.pm module.
These need to be reimplemented!

1. generateSubscriberListRef( $msgType, $params );
   This sub generates a list of users of the system who are subscribed to
   the given MsgType with the also given set of parameters. This is the 
   place where Filters need to be implemented on base of MsgType and 
   the parameters. 

   For example, the Message Type is PRODUCT_CHANGE, but your Hermes has
   a subscription filter filtering on product = name all subscriptions
   that do not pass this filter should be dropped out. Check the 
   example implementation in Buildservice.pm for now. TODO

2. expandMessageTemplateParams( $templateObject, $msgRef )
   This gets the message template (which is a HTML:Template object) and 
   the message parameters. This sub can compute if the template contains
   keys which need to be added to the values hash. 
   The default implementation just returns the original parameter hash 
   because nothing additionally is needed.


Diff Generation

For package changes for example people often want to have the diff of the change in the mail they get from Hermes which notifies them about the change. For that, a text template for a certain message type only needs to contain a parameter called diff.

  • the parameter collection needs to have parameters package and project and sourcerevision

If that is the case, the diff is retrieved from the OBS API and the text template parameter diff is replaced with it accordingly.

Note that the diff might be limited in size, depending on the Hermes configuration variable OBSMaxResponseSize. Make sure to check that.

More Customizations

TO BE DOCUMENTED