Tuesday, 5 June 2007
How the CI Example From MS Works
Continuous Integration is not built into the current version on TFS, however MS ship an un-official CI solution. I've never had reason to dig into how this worked until the last day or so and thought I'd post what I found.
When the CI example receives a check-in event it queues a new build. It does this by calling QueueUserWorkItem which means it uses the .Net thread pool to do the work. The web service calls QUWI for each unique build type that's been scheduled. So if I have two build types called typeA and typeB, if I schedule typeA and typeB they get separate thread pool threads, one for each type. If while typeA is building and another notification comes in then the build type doesn't get re-scheduled. What happens is that the thread running the typeA build looks at a flag to see if another build has been scheduled for this type. If a build is pending then it simply loops around and runs the next build in the queue. So there's only one build type per thread. If a given build type is already executing and another notification comes in then the build runs again.
This means that each check-in does not kick off a separate build. A build will run after 1 or more check-ins and after the previous build has completed.
Posted by at 4:34 PM in Net
