2011/01/28

Gated builds living in Harmony. How NO_CI kicked my ass.

It should come as no surprise that I love me some TFS 2010. Microsoft's ALM package is so good. It takes the place of a slew other tools (SCM, build server, bug tracking, document repository, work assignments, and more). Really, TFS is like bacon wrapped bacon for your development team.

We've implemented rolling deployments that stage for up to an hour before pushing out to our dev web servers. The templates have some pretty heavy WF hacks to version assemblies, cycle IIS app pools and websites, push the web code, and execute some console apps that are part of the compilation. They've been working great but they don't keep broken code from getting in to the source control repository.

On a new branch of the code tree, I've mirrored the rolling builds from the trunk. I also added a Gated build to avoid bad code ever being checked in. Hit the Googles if you don't know what a gated build is as there is a wealth of info out there about setting up basic Gated builds.

So why this post? Well there is a funny thing that happens after the Gated build intercepts the check-in and verifies the build. When everything builds correctly, it will commit the changes you requested and add to your comment ***NO_CI***

No problem, right? It's just some extra text, right? Well... not really. You see, putting ***NO_CI*** anywhere in your check-in comment tells the build service (just an event subscriber) to not look at this changeset for any Continuous Integration bits. You may have guessed by now that Rolling builds are.... a form of Continuous Integration. At least, as far as the TFS build service is concerned.

With the gated builds trucking away, I never get a Rolling build to be dropped into the queue.

To the Googles... again.
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/cff735c5-403a-48ed-bd5c-5cbb26a0c089

Here is where the goodness is. Open up the template being used for your Gated build. Navigate to

Process > Sequence > Run On Agent > Initialize Workspace > Get Workspace
This action has a property named NoCIOption that is set to True on the default template. What I'd suggest at this point is to create a new boolean argument and hook up the metadata so you can set it edits of the build.

Now, when the Gated build completes, it performs the check-in on your behalf without the ***NO_CI*** and then any  CI or Rolling builds function as desired.

Comments