问题
We have CruiseControl doing nightly builds for us. If the nightly build fails it sends out an email. The programmer will fix the problem check in his/her changes then do a force build. If the build fails then an email is sent again. Is there a way to not send email when a force build is pressed.
回答1:
I don't think it is possible in 1.4. But, it should be possible in 1.5 with the new tag "dynamicvalues" for the Email publisher.
This tag should have two variables you may be able to check. Since it hasn't been fully released, I can only speculate what might work for your specific needs.
Possible Tags:
- CCNetRequestSource = IntervalTrigger for you (this would only email if the interval trigger was the cause of the build)
- CCNetBuildCondion = IfModificationExists (this might ignore forced builds)
Example:
Your config will eventually have something similar to this in the email publisher:
<email>
...
<dynamicValues>
<directValue>
<property>buildArgs</property>
<parameter>BuildArgs</parameter>
<default>-t:$[$CCNetRequestSource|IntervalTrigger]</default>
</directValue>
</dynamicValues>
...
</email>
CruiseControl.NET version 1.5 is already CTP. So, it will be soon.
Link Heaven:
- http://confluence.public.thoughtworks.org/display/CCNET/Email+Publisher
- http://confluence.public.thoughtworks.org/display/CCNET/Dynamic+Parameters
回答2:
Add the following to your config
<modifierNotificationTypes>
<NotificationType>Change</NotificationType>
</modifierNotificationTypes>
回答3:
Now I'm using some kind of workaround:
<triggers>
<parameterTrigger>
<trigger type="scheduleTrigger">
<time>01:00</time>
<buildCondition>ForceBuild</buildCondition>
</trigger>
<parameters>
<namedValue name="SmtpServer" value="smtp.mail.com"/>
</parameters>
</parameterTrigger>
</triggers>
<publishers>
<email mailhost="fake" from="night.builder@mail.com" includeDetails="true" mailhostUsername="night.builder" mailhostPassword="xxx" useSSL="FALSE">
<dynamicValues>
<directValue property="mailhost" parameter="SmtpServer" default="fake" />
</dynamicValues>
</email>
</publishers>
I tried to use No element from Email Publisher, but with no success.
If someone has more proper solution, please share it here.
来源:https://stackoverflow.com/questions/1143425/cruisecontrol-net-email