Monday, 31 August 2009

CruiseControl.NET failing on SVN (or other source control) failure

Our SVN is offsite and hosted by another company.  It works really well, but occasionally the CruiseControl.NET server is unable to make a connection (for whatever reason) and the build fails.  This happens a lot when we’re doing backups, or if we have an outage or just occasionally for no reason at all.  We do 1440 build tests a day (that’s one a minute) so I suppose it’s no surprise.  We do roughly 2 check ins a day (small team) per project and we get roughly 2 failures a day, so my build history is roughly 50% failure (more if you count the weekends).

Well I’ve finally found out how to stop this from happening.  With the newer version of CruiseControl (well it’s not that new now, but no matter) there is a tag to allow for source control errors and decide what to do when they happen.

The attributes are added to your <project> tag:

   1: <maxSourceControlRetries>10</maxSourceControlRetries>
   2: <stopProjectOnReachingMaxSourceControlRetries>true</stopProjectOnReachingMaxSourceControlRetries>
   3: <sourceControlErrorHandling>ReportOnRetryAmount</sourceControlErrorHandling>

This is fairly straight forward, those tags will allow my source control to retry 10 times.  It will stop building my project when it fails 10 times and it will do nothing but report the number of retries if it fails.  Add these 3 lines to each of your projects and then when you bring down your version control system your build won’t fail.


Anonymous said...

Very helpful, thank you!

Harrison said...

Another "Thank you" for this information.