Email Notification Custom Hooks

Is there any way in TeamCity to support custom email publishers? I know it has the templating system, which looks nice, however it doesn't let me add my own code for processing the email output.

Right now, we have a custom CruiseControl publisher that searches through our build errors for filenames. It then tries to match these filenames with files in the Subversion modification list. So that way, 90% of the time we can identify a given build breakage to a given user and add their name as a "suspect" to the header of the email. Taking a .cpp and then looking for .cpp, .h or .obj with that filename catches the build failure the majority of the time in C++.

However, I couldn't port this code over to TeamCity's email template system as far as I can tell. Is there an API I can use to write a plugin?

2 comments

Hi,

It is possible to write a plugin for TeamCity, basic information is available at

http://www.jetbrains.net/confluence/display/TW/Plugin+Development

To add more processing to messages, do the following:

- Create a class which takes TemplateMessageBuilder as constructor parameter and
use method setPatternProcessor(String pattern, TemplatePatternProcessor processor)
to register additional template pattern,
- write code for finding user to blame,
- package and deploy plugin to TeamCity (see link on Plugin Development above)
- add pattern to template in .BuildServer/config/email-config.xml

see rough code sample below for reference.



Kind regards,
KIR

0

Thanks, that looks perfect!

0

Please sign in to leave a comment.