Getting Started with TFS Build Virtualizer

Today I uploaded the source for TFS Build Virtualizer to CodePlex under the MIT license. I have also put up a release (1.0 RTM) which is compatible with Team Foundation Server 2005 and Virtual Server 2005 R2 SP1. The TFS Build Virtualizer was originally developed by Readify.

From the project description:

“TFS Build Virtualizer is an extension to the Team Foundation Server build system which allows build masters to have a large number of virtualized build servers with Team Build installed. When a build is invoked the build virtualizer determines which build server to use to run the build and communicates with Virtual Server 2005 where it exists in a saved state.

The build virtualizer resumes the build server from saved state, and forwards the build request into the build server where it builds normally. Once the build completes (success or failure) the build server is put into a saved state once again.

Benefits of using this approach include being able to have a large number of build servers (for each team, or different build environment) and be limited by only the amount of available disk space.

The build virtualizer is designed to accommodation multiple different TFS servers and has configuration settings to restrict which hosted virtual machines developers can request access to.”

If you would like to get involved with this project please contact me via my CodePlex profile page, or, if you find any problems or requests create a work item via the Issue Tracker.

Getting Started with TFS Build Virtualizer

TFS Build Virtualizer is installed as two components. A component that is installed on the Team Foundation Server, and a component that is installed on Virtual Server 2005. These components are called “Build Virtualizer” and “Build Virtualizer Proxy” respectively.

image

The Build Virtualizer is responsible for mocking a Team Build instance and forwards requests to the Build Virtualizer Proxy to start up virtual machines over a WCF channel. The Build Virtualizer Proxy communicates with Virtual Server 2005 R2 SP1 via the COM automation API.

Installing and Configuring the Build Virtualizer Component

In order to install the Build Virtualizer component you need to first download the release from CodePlex. From this zip file you need to extract the following files:

  • BuildVirtualizer.exe
  • BuildVirtualizer.exe.config

These two files should be placed somewhere in the file system of your TFS server. I would recommend “C:\Program Files\Build Virtualizer”. Once these files are in place you should issue the following command at the command prompt:

  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /i “[install path]\BuildVirtualizer.exe”

During the installation/configuration process a dialog will be displayed asking for valid windows credentials. Typically I would use the build service account (e.g. [DOMAIN]\TFSBUILD) for this purpose. Once this is configured you need to modify the configuration file, BuildVirtualizer.exe.config, the contents of the file are as follows.

First, change the endpoint that Build Virtualizer will communicate to the Build Virtualizer Proxy with. This is typically done by replacing “localhost” with the name of the Virtual Server 2005 R2 SP1 machine.

image

Next, specify the name of the Team Foundation Server that the Build Virtualizer will communicate with to initiate builds. You might also like to specify a “DefaultBuildMachine” to use if a build type has not been explicitly configured to use the virtualization features.

image

Finally, specify the names of the build servers (running as virtual machines) that the Build Virtualizer instance on this machine will be allowed to request that the Build Virtualizer Proxy starts.

image

Finally, in the Team Project’s build type directory needs to have a BuildVirtualizer.xml file added (sample location: $/MyProject/TeamBuildTypes/BuildVirtualizer.xml). The Build Virtualizer reads this file whenever a build is initiated:

image

If a mapping is missing for a particular build type, then the default build server is used. All the build types that use virtualization should then be configured to point to the local TFS server as the Team Build server (Team Build should be stopped/disabled on the TFS server). Once this configuration is done it is safe to start the Build Virtualizer on the TFS server with the following command:

  • net start BuildVirtualizer

Next up, we need to configure the Build Virtualizer Proxy on the Virtual Server 2005 R2 SP1 machine.

Installing and Configuring the Build Virtualizer Proxy Component

In order to install the Build Virtualizer Proxy component you need to first download the release from CodePlex. From this zip file you need to extract the following files:

  • BuildVirtualizerProxy.exe
  • BuildVirtualizerProxy.exe.config
  • Interop.Microsoft.VirtualServer.Interop.dll

These two files should be placed somewhere in the file system of your TFS server. I would recommend “C:\Program Files\Build Virtualizer”. Once these files are in place you should issue the following command at the command prompt:

  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /i “[install path]\BuildVirtualizerProxy.exe”

During the installation/configuration process a dialog will be displayed asking for valid windows credentials. Typically I would use the build service account (e.g. [DOMAIN]\TFSBUILD) for this purpose. Once this is configured you need to modify the configuration file, BuildVirtualizerProxy.exe.config, the contents of the file are as follows.

The service endpoint address needs to be configured so that the Build Virtualizer messages are processed correctly, this should be the name that the Build Virtualizer knows the server by.

image

Optionally, the metadata GET URL should be updated with the host name as well:

image

And finally, the list of build servers that the Build Virtualizer Proxy is allowed to start and stop in Virtual Server need to be specified. The idea is that the Build Virtualizer Proxy can actually service multiple Team Foundation Server instances, but this list is the governing superset of build servers that can be worked with. The similar list in the BuildVirtualizer.exe.config file is the build servers that the users of that TFS instance can get access to. It isn’t designed to be a security mechanism, just a sanity filter.

image 

Finally, once you have configured the Build Virtualizer Proxy, you need to start it with the following command:

  • net start BuildVirtualizerProxy

Now to get your build servers up and running.

Preparing Your Virtual Build Servers

Once you have configured the Build Virtualizer and Build Virtualizer Proxy, you need to create a virtualized build server that they can start and stop. You may have some of these already. Once they are configured with Team Build and connected to the Team Foundation Server instance, simply go to the Virtual Server 2005 R2 SP1 console and “save state” the virtual machine. Once you initiate a build the build virtualizer should intercept it, start the build server, perform the build, and then save its state back down to disk.

What’s next? Want to help out?

If you have any feedback please use the Issue Tracker and create a work item. Finally if you would like to help out with the project I’ve got the following roles available:

  • Documentation Writer; responsible for updating CodePlex wiki and producing installation guide.
  • Tester; responsible for testing installation process and operation of the tool.
  • Developer; joint responsibility with me in designing and developing the TFS Build Virtualizer moving forward.

If you are interested contact me via my CodePlex profile page. Thanks for listening! I hope you find the TFS Build Virtualizer useful in your organisation.

P.S. Please note that once we get real documentation in the CodePlex wiki this page will become obsolete, but I will put a link to the equivalent documentation at the top of the page.

6 thoughts on “Getting Started with TFS Build Virtualizer

  1. Pingback: Getting Started with TFS Dependency Replicator « notgartner

  2. Pingback: PaulStovell.NET » Mitch has been busy

  3. Pingback: Team System News : VSTS Links - 12/18/2007

  4. Pingback: Getting Started with TFS Build Virtualizer « notgartner « Noocyte’s Weblog

  5. Pingback: Miguel Madeira : TFS add-ons list

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s