Monday, March 30, 2009

CI - Failed team build watcher. Part I - main ideas.

This is my DIY activity, so sorry if something like this already exists, I have not been searching that long. I'd highly recommend to look at the buddy build http://www.codeplex.com/BuddyBuild as well as gated check-ins feature in Team System 2010 http://blogs.msdn.com/jimlamb/archive/2009/01/23/coming-soon-gated-check-in.aspx will make this quite obsolete.

Problem definition:

1. First Developer check-ins files, breaking the build
Action required: Send notification email with build errors list and link to the detailed log file.

BuildGateKeeperFile1

2. Second Developer check-ins files, his check-in doesn't build as build is broken by the First Developer
Action required: Send notification email to the Second Developer saying build can't be verified. CC the First Developer on it (knock-knock on his conscious).

BuildGateKeeperFile2

3. Third Developer check-ins -> same as the second.

4. Corrective check-ins -> team build builds
Action required: Notify the check-in author of successful check-in

BuildGateKeeperFile3

*Names of all devs in the sreenshots are mine as an implication of testing on myself. As well as error message is faked in the team build target so I don't need to wait for the compilation to complete.

Implementation ideas:

1. Don't use the Team Build API as its query ability is quite limited. In this case we need the first build breaker after the last successful build.
2. Even if possible to code completely with bunch of msbuild and community build tasks http://msbuildtasks.tigris.org/, still I decided to go with custom task(s), except for sending email I used Email community task and for reading error logs I used msbuild ReadLines task.
Main reason for this decision was ability to provide unit/integration tests instead of taming/tuning a bunch of xml (Still there is enough xml left :))
3. Introduce failure state file to keep the data of the build breaker immediately following the successful build. That is to compensate the absence of the "build query language" already referred to in point #1.

Implementation time required - 5 hours
Test coverage achieved at the moment - 60%
Lines of code - to be counted
Implementation guide, source and binaries - coming in the next post

No comments: