RLM TFS Integration Setup - BMC Software...You want to demonstrate or use TFS integration with...

Preview:

Citation preview

TFS integration with RLM

Sharad Gupta

  2  

Table of Contents

Problem: .......................................................................................................................... 3 Solution: .......................................................................................................................... 3

SQL Server Setup: ...................................................................................................... 4 TFS Setup: ................................................................................................................... 5 Visual Studio Setup: ................................................................................................... 7 QTfs Listener: ............................................................................................................. 9 Package setup under RLM: ..................................................................................... 14

  3  

Problem: You want to demonstrate or use TFS integration with BMC’s Release Lifecycle Management solution. By integrating the tools, you want to be able to achieve continuous deployment so that whenever a build quality event changes in TFS (such as a Release Manager flagging a particular build for deployment release), RLM automatically picks-up the artifacts from TFS, creates a deployable instance and ultimately deploys that instance across Dev>Stage>Production or any other pre-configured route.

Solution: Shown here is an example setup of integration between TFS and RLM using QTfsListener utility. This utility listens for build quality change events in TFS and then, automatically creates a package instance and deploys that instance along a given route.

  4  

SQL Server Setup:

1.) In my example setup, I used SQL Server 2008 (had trouble integration TFS 2010 with any other more recent SQL Server):

  5  

TFS Setup:

1.) Setup Team Foundation Server:

2.) Create a default collection (DefaultCollection in my example):

  6  

3.) Set up default project in the collection (ShoppingCart in my example):

4.) Create a new build configuration to be able to build checked-in projects:

5.) You can also access TFS using web browser by going to http://localhost:8080/tfs. Your hostname for TFS might be different than localhost, so change accordingly.

  7  

Visual Studio Setup:

1.) Setup Visual Studio 2010:

2.) Create a sample project (ShoppingCart) and check-in it with TFS. In my example, I created a barebones “ASP.NET Web Application” which I named as ShoppingCart:

  8  

3.) Within Visual Studio, create a new build definition that would put the newly created builds in a network location:

Notice the build drop location – that value will be pulled by QTfsListener utility to signal to RLM where to pull build artifacts from.

  9  

QTfs Listener:

1.) Download Q-4.1-TFS-Full.zip file from www.varalogix.com/software/q. This package contains the QTfsListener utility that listens for Build quality change events in TFS and then, automatically kicks off instance creation in RLM. It passes on few important properties (screenshot later in this document) which tells RLM where to pick-up the deployment artifacts from (BUILD_DIR). In addition, this same utility can kick-off the deployment for the built instance.

2.) The 2 configuration files in the above screenshot: QMappings.xml and QTfsListener.exe.config tell QTfs how to connect to TFS and RLM deployments. The configuration files, themselves, have been well documented as part of “VaraLogix Q - Team Foundation Server Integration Using QTfsListener.pdf” document. Here are the settings that I am using in my environment (with highlighted values being the changes I made pertaining to my setup).

3.) QMappings.xml <DeploymentMappings xmlns="http://www.varalogix.com/QTfsListener/QMappings20120404"> <Mapping BuildDefinitionPattern="ShoppingCart" Computer="*" OriginalQuality="*" NewQuality="Ready for Deployment" SuccessQuality="Q Deploy Processing" FailureQuality="Q Send Failure" QPackage="ShoppingCart" QRoute="Dev-IIS" DeployInstance="false" /> </DeploymentMappings>

4.) QTfsListener.exe.config

<?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

  10  

<section name="QTfsListener.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <applicationSettings> <QTfsListener.Properties.Settings> <setting name="TfsUserName" serializeAs="String"> <value /> </setting> <setting name="TfsDomain" serializeAs="String"> <value /> </setting> <setting name="TfsPassword" serializeAs="String"> <value /> </setting> <setting name="TeamProjectCollectionUri" serializeAs="String"> <value>http://127.0.0.1:8080/tfs/DefaultCollection/</value> </setting> <setting name="BaseAddress" serializeAs="String"> <value>http://127.0.0.1/Temporary_Listen_Addresses/QTfsListener</value> </setting> <setting name="QAPIHost" serializeAs="String"> <value>172.21.122.64</value> </setting> <setting name="QAuth" serializeAs="String"> <value>root root</value> </setting> </QTfsListener.Properties.Settings> </applicationSettings> <system.diagnostics> <!-- Uncomment the switches section to increase trace verbosity --> <switches> <add name="Varalogix.Utility.TeamFoundation.Common" value="Verbose" /> <add name="QTfsListener" value="Verbose" /> </switches> <trace autoflush="true" /> </system.diagnostics> </configuration>

5.) At this time, start the QTfsListener.exe utility from the command line with “-d” switch to enable debug mode. The utility can also be installed as a windows service so it can run in the background.

6.) Create the “Ready for Deployment” build quality event in TFS, if it doesn’t already exist.

  11  

7.) At this time, you can either “queue” a new build or change an already existing build’s quality event so that QTfsListener can pick-up the change & create an instance of the package in RLM

  12  

8.) After you change the build quality, the QTfsListener will pick up the change and call RLM’s API to create a new instance of “ShoppingCart” package. Please make sure to create a bare minimum package “ShoppingCart” beforehand in RLM for the following dynamic properties to be set from QTfsListener.

  13  

  14  

Package setup under RLM:

1.) Create an IIS7 Blueprint and a Channel definition to correspond to IIS7 blueprint. 2.) Assuming you created a bare minimum package named “ShoppingCart” before

executing last step in previous section, all the below properties will get set accordingly:

All these properties were dynamically set by QTfsListener except IIS_POOL_NAME, which I had set while creating the package initially. You can cross-match these properties with the 2nd command prompt screenshot from the last section. You can, then, use these properties to create reference to the content or in other words, the manifest for the package like below:

  15  

3.) In my case, I am copying all the files from the TFS_DROPDIR folder and its indicated subfolder to the destination location (IIS Webroot). Below is the configuration of “Process” or Deployment action for ShoppingCart package:

  16  

(To be updated – with instructions to continue with the deployment of this instance and upon successful completion, updating the build quality event in TFS to indicate successful deployment in RLM).