views:

157

answers:

1

We send out emails for any build status. If the build fails I want to either:

  • send an additional email with an attachment
  • conditionally attach an file to the email

Either one works for me, but the second option is better I think.

How can I do that in the CC.NET config file?

Can I have two sections - one with and another with

Perhaps is what I want, but I can't find an example of that.

Right now the config file looks like:

<publishers>
    <buildpublisher>
      <sourceDir>...</sourceDir>
      <publishDir>...</publishDir>
    </buildpublisher>
    <buildpublisher>
      <sourceDir>...</sourceDir>
      <publishDir>...</publishDir>
    </buildpublisher>
    <xmllogger />
    <email from="..." mailhost="..." mailhost Username="..." includeDetails="True">
        <users>          
          <user name="..." group="..." address="..."/>
        </users>
        <groups>        
          <group name="buildstatus" notification="Always" />
        </groups>
        <xslFiles>
          <file>xsl\header.xsl</file>          
          <file>xsl\modifications.xsl</file>          
        </xslFiles>        
      </email>

I am guessing I should add

<onfailure>
 <attachments>
  <file>...</file>
  </attachments>
 </onfailure>

I'm looking for a definitive example of some configuration that shows a publisher sending an email with an attachment for a filed build.

+2  A: 

from ccnet 1.5 onwards , you have the conditional publisher : http://confluence.public.thoughtworks.org/display/CCNET/Conditional+Publisher

Williams
Thanks - but how does one match the condition with the publishers to execute? Is it just by order?
Tim
Yikes - we're running version 1.0.1.1277 based on the dashboard I see.
Tim
<tasks>...</tasks><publishers> <conditionalPublisher> <conditions> <condition>Failure</condition> <condition>Exception</condition> </conditions> <publishers> the publishers you want on these states </publishers> < other publishers></publishers>you can add multiple conditional publishers(did not try, but should work)
Williams
the xml view is not that ok, but if you copy the above into an xml editor, you get the idea :-)
Williams