views:

320

answers:

6

My team has a goal to minimize the amount of time that our build is broken.

We use CruiseControl.NET for continuous integration. What I'd like to find out is how best to approach answering the following question:

"In the last {timespan}, how much time has {project-name} spent in a broken status?"

For example: "Over the last 1 month, how much time has our project spent in a broken status?"

Are there any advanced features of CruiseControl.NET that would facilitate making this information available in some type of a report or somewhere in the dashboard?

Alternatively, how would you approach parsing the xml artifact files to glean this info?

+1  A: 

Having had a very quick look at the CC docs, I imagine if you were writing your own Cruise control dashboard, you could consume the RSS feed of build results, parse in all the date times and success/failure states up to your threshold, then sum up the totals.

As for displaying it in a dashboard, I think Cruise Control has a plugin architecture which might help http://cruisecontrol.sourceforge.net/main/plugins.html

Andrew M
I'm referring specifically to CruiseControl.NET. Do you know if any of that documentation from CruiseControl also applies to CruiseControl.NET?
bhazzard
+2  A: 

I see at least two ways to approach this:

  1. You write an external tool which parses CC.NET's XML log files for a project (stored in buildlogs subdirectory by default), calculates statistics and writes a HTML report. This is probably easier to do, but it won't be directly integrated with CC.NET.
  2. You write a CC.NET plug-in to do this. You'll need to do a bit of investigating in this case. My guess the starting point would be to look at the source code of some existing plug-in.

Here are some links about CCNET plugins:

Igor Brejc
+1  A: 

you can use the statistics publisher, http://confluence.public.thoughtworks.org/display/CCNET/Statistics+Publisher and you can display them via project statistics plugin

Williams
A: 

So how much time (in avg.) the build was broken?

Tamir Gefen
More than we wanted, but that's precisely why we needed this metric. At the end of the quarter we're shooting to have no more than 8 hours time that the build was in a failed state for month three (as a first step). The idea here is to change our habits so that our project is more stable.We haven't met the goal yet, but having the metric is helpful.
bhazzard
A: 

So my eventual solution wasn't ideal, but it was easy to do and it works:

I had CC.NET send build emails to an email address (we'll call it build_emails@build_statistics.com). Then I use a ruby script to get the emails via imap and process them to determine our build failure time.

I didn't go the route of directly parsing the xml because I would have had to parse every xml file in the timeframe to build up a timeline and then go over the timeline to make my calculations. It just seemed too complicated to get a simple statistic like this.

bhazzard
Update: this turned out to be a terrible unmaintainable solution. :P
bhazzard
A: 

I like cc.net, but in this case TeamCity just does this for you. It has lots of other great statistics too. It's free for less than 20 projects.

Mike Two
Team City does look pretty neat. Out of curiosity, how would one answer this question using TeamCity?
bhazzard
@bhazzard - Team City shows statistics for each build configuration that shows the time to fix the build over a day, week, month, quarter, year or all time. their docs show an example of the statistics page http://confluence.jetbrains.net/display/TCD5/Statistics. It also has a restful api that you might be able to use to query it. Can't say I have tried the query method yet. I just look at the graph.
Mike Two