Email Group Configuration in CC.NET using a single config file

Tag: email , configuration , , groups Author: quejx03 Date: 2009-07-14

We have started using CC.NET for continuous integration and as the number of projects monitored builds up I would like configure the email alerts via a single config file.

What I mean by this is that I would like to have a list of the users in different groups in a single config file that is referenced by ALL the project configuration files:

<user name="user1" group="buildmasters" address="[email protected]"/>
<user name="user2" group="internalapplications" address="[email protected]"/>
<user name="user3" group="internalapplications" address="[email protected]"/>
<user name="user4" group="externalapplications" address="[email protected]"/>
<user name="user5" group="externalapplications" address="[email protected]"/>

Then the project configuration file will reference the correct group:

<group name="internalapplications" notification="change"/>

So for the different projects that are internal applications I would import the single config file then set the internal applications group. I would also like to add buildmasters for everything so that for now I can keep track of people if they are having problems.

This would mean I'd like to have a user in two or more groups for example but I don't know if it's possible:

<user name="user1" group="buildmaster, externalapplications" address="[email protected]"/>

I've been working under the assumption that one day I could configure this and have just a single file with all the users email addresses in, but today I've gone to do it and I'm not sure it works like this.

Can anyone describe how they have approached this?


Best Answer

What you want to do is use CC.Net Configuration Preprocessor

I made an email.config

<cb:define name="email-template" xmlns:cb="urn:ccnet.config.builder">
    <email from="[email protected]" mailhost="server" includeDetails="TRUE"
         mailhostUsername="buildadmin" mailhostPassword="pass">
        <user name="dev" group="dev" address="[email protected]"/>

        <group name="buildmaster" notification="always"/>
        <group name="developers" notification="always"/>


and included it where needed...

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">

    <cb:include href="C:\email.config" />

<project name="MyProject" queue="Build" queuePriority="1" >

    <cb:email-template >



<project name="MyProject2" queue="Build" queuePriority="1" >

    <cb:email-template >





That looks spot on, thanks Ryu!

Other Answer1

How about taking a slightly different approach.

Manage the groups through your e-mail server and send mails to the group alias.

That way it's trivial to have the same users in different groups, plus you shouldn't need to change your config files if the group membership changes.

Doing this with Exchange is pretty easy, don't know about other e-mail systems.


Cheers Glen, it's a nice idea I hadn't thought of getting the functionality I want using a different approach - I will do now though. In this instance we use Lotus Notes which is corporate and I don't have free and easy access to the e-mail server to set this up myself (I don't want to rely on our e-mail team as I'd like it doing this year...)