Question

Currently my CruiseControl.NET email publisher has its list of users hard-coded in the build config file

<publishers>
    [ ... ]
    <email from="autobuild@domain.com" mailhost="stmp.domain.com" mailport="25" includeDetails="TRUE">
        <replyto>buildserver@domain.com</replyto>
        <users>
            <user name="a.user" group="buildmaster" address="a.user@domain.com"/>
            <user name="b.user" group="developers" address="b.user@domain.com"/>
        </users>
        <groups>
            <group name="developers">
                <notifications>
                    <notificationType>Failed</notificationType>
                    <notificationType>Fixed</notificationType>
                </notifications>
            </group>
            <group name="buildmaster">
                <notifications>
                    <notificationType>Always</notificationType>
                </notifications>
            </group>
        </groups>
        <modifierNotificationTypes>
            <NotificationType>Failed</NotificationType>
            <NotificationType>Fixed</NotificationType>
        </modifierNotificationTypes>
    </email>
</publishers>

I'd like to be able to read the list of users from an external file. We have dozens of build files and I'd like to streamline the process of adding new users and removing ones that are no longer interested.

Can I do this?

Was it helpful?

Solution

Yes - just look at the Configuration Preprocessor, specifically at the Include section.

You can move your <users/> node into a separate file called e.g. email_users.xml and maintain it in a single place, then just include it with <cb:include href="email_users.xml"/>

Sample email_users.xml file:

<?xml version="1.0" encoding="utf-8"?>
<cb:config-template xmlns:cb="urn:ccnet.config.builder"
  xmlns="http://thoughtworks.org/ccnet/1/5">
  <users>
    <user name="a.user" group="buildmaster" address="a.user@domain.com"/>
    <user name="b.user" group="developers" address="b.user@domain.com"/>
  </users>
</cb:config-template>

And remember that for this to work, you main file should start with

<cruisecontrol xmlns:cb="urn:ccnet.config.builder"
  xmlns="http://thoughtworks.org/ccnet/1/5"> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top