Question

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="user1@company.com"/>
<user name="user2" group="internalapplications" address="user2@company.com"/>
<user name="user3" group="internalapplications" address="user3@company.com"/>
<user name="user4" group="externalapplications" address="user4@company.com"/>
<user name="user5" group="externalapplications" address="user5@company.com"/>

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="user1@company.com"/>

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?

Was it helpful?

Solution

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="buildadmin@server.com" mailhost="server" includeDetails="TRUE"
         mailhostUsername="buildadmin" mailhostPassword="pass">
      <users>
        <user name="dev" group="dev" address="dev@server.com"/>

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

    </email>
</cb:define>

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 >

    </cb:email-template>

</project>

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

    <cb:email-template >

    </cb:email-template>

</project>

</cruisecontrol>

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top