Question

We recently converted from SVN to Git. In the process we are updating our CCNET configuration to support our shiny new Git repository. However we hit is snag with the email publisher.

Prior to the Git switch the email publisher used a regexconvertor to convert a user name to an email. This worked well as our SVN user name was our AD account name and could be easily converted to an email address simply by appending @ourdomain.com.

When we switched to Git we made the decision that our Git username and email would match what we commonly saw in the wild which was to use your full name including spaces and to include your email address like so:

[user]
    name = James Kirk
    email = jtkirk@starfleet.com

This means that our regex convertor incorrectly creates usernames based on the committers name. For names with spaces it would create an email with the name surrounded by double quotes like:

"James Kirk"@starfleet.com

In turn this means committers never receive build emails for their commits. In addition we cannot use the LDAP convertor as our full name may not fully resolve to a unique AD entry from which we can pull an email address.

However, we all add our email to our Git commits as well. I hope to configure CCNET to just use this email address to send to our committers as this is the correct email to use and is readily available from Git.

How can we configure the CCNET email publisher to send emails to the committers based on the Git email attached to each commit?

Was it helpful?

Solution

At the time of this answer it does not appear to be possible to to hook into the Git author and email to parse out the email address with CCNET.

The workaround is to get a list of all the committers to your Git repository and enter them like so under the element. The name must match the name of the user's name in the commit exactly, including case. Do not specify a group for these users if you want them to receive emails only for builds in which they contributed a commit.

<email includeDetails="TRUE" subjectPrefix="CCNET Project ">
    <from>mybuild@starfleet.com</from>
    <mailhost>email.starfleet.com</mailhost>
    <users>
        <!-- Do NOT specify a group to send an email to these folks
         if and only if they have committed changes that are part 
         of the current build. The 'name' much match the 'name' 
         used in the commit log exactly (case sensitive) -->
        <user name="James Kirk" address="jkirk@starfleet.com" />
        <user name="Bones" address="lmccoy@starfleet.com" />
    </users>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top