April 4th, 2014

Release Management – Continuous Deployment with Visual Studio Online and any CI Systems

[Update: The technique described below is only valid for Agent-Based release templates. To achieve similar behavior for vNext release templates, follow the instructions from the article Trigger Release from build with Release Management for Visual Studio 2013 Update 3.]

 

Visual Studio Release Management 2013 Update 2 RC release ships with an updated Release command line tool.

The new options of that command line tool opens new possibilities in terms of continuous deployment (triggering a Release from a check-in/build). You can now trigger a Release from any CI Server. You can also implement continuous deployment with RM and Visual Studio Online if the TFS build agent used is on prem. This article will focus on RM and VS Online, but the information here can help in setting up RM with any CI Server.

Build Template modification

In order to trigger a new Release, we need to add a process call to the RM command line tool within your build execution. The process command will look like this:

ReleaseManagementBuild.exe –rt ‘MyReleaseTemplateName’ –pl ‘MyPackageLocation’ –ts ‘ReleaseTargetStage’

Argument

Usage

MyReleaseTemplateName

Name of the release template to use with this release. Value is Case sensitive

MyPackageLocation

The drop location of the build. This will be used as your source through the entire Release Path.

ReleaseTargetStage

The final state to deploy this build too.  This value is optional.  If left blank the build will be released to all stages.  Value is Case sensitive.

When using TFS, modify your build template by following the steps of the “Modifying your own custom build process template” section of the following article. However, make sure to use the snippets file attached to this article.

Triggering a build

Once the build template modifications are applied, the build definition will show a new section of parameters. Consider the following when using the Release Management build process template.

  1. When using the functionality to automatically trigger Releases from a Build, you will need to install the Release Management client on your Build Agent machine. After installation, restart the TFS Build Agent. This is so that the needed file are available locally on the machine and the provided build template knows where to find them.
  2. The Components defined in RM must have its source set as Builds externally. From the three parts of the UNC Path to Package, only the last (package subfolder) will be used and appended to the –pl argument value given in the command.
  3. In the Build Definition, Build Defaults section, select the Build Controller connected to your on prem agent. Also set the Staging location to be Copy build output to the following drop folder to have the output of the build accessible to your deployment agents.
  4. While editing the Build Definition, Set the Release Build parameter to True, to indicate that you want the build to be released.
  5. Specify the Target Stage for the Release in the Release Target Stage parameter. If left blank the Release will go through all the Stages defined in the Release Path. The check is case sensitive so make sure to match the name of the Target Stage verbatim.
  6. Specify the name of the Release Template you wish to deploy in the Release Template field. This too is case sensitive.
  7. Make sure that the account running your build is a Service User within RM (while viewing a User, set the Is a Service User? field to Yes.

  

ReleaseCMDTemplate.12.Snippets.xaml

Category
CI/CDDevOps

0 comments

Discussion are closed.