Microsoft Release Management – Part 3: Configuring the release

Reading time ~5 minutes

In previous posts (I and II) we have seen how to configure Release Management and an environment to work with. Now it's time to configure our first release to see how a modification in the code could travel from our Visual Studio to production.

Go to Configure Apps -> Release Templates.

[caption id="attachment_140" align="alignnone" width="1036"]Create Release Template - 1 Create Release Template - 1[/caption]

Click on New and fill the basic information.

[caption id="attachment_141" align="alignnone" width="1036"]Create Release Template - 2 Create Release Template - 2[/caption]

Click on Edit button next to Build Definition textbox and select the build that the release will use.

[caption id="attachment_142" align="alignnone" width="632"]Create Release Template - 3 Create Release Template - 3[/caption]

As you could see, you have an empty release template. You could see the three stages defined in our release path (see II) with an empty deployment sequence. Our work now is to fill this deployment sequence to be able to deploy the website we've created using Visual Studio.

To do this we will need to create a new component. We will use components to deploy an application. In our case, we are going to create a component to copy the files of the web site from build folder to IIS folder. So, right click on components and click on Add.

[caption id="attachment_145" align="alignnone" width="1032"]Create Release Template - 6 Create Release Template - 6[/caption]

Choose a meaningful name for the component and select XCopy deployer tool. As you can see, there are a lot of options to be able to deploy correctly your application. Choose the right one for your project.

[caption id="attachment_143" align="alignnone" width="1036"]Create Release Template - 4 Create Release Template - 4[/caption]

Click on Configuration Variables. As we will see later, we can tokenize our deployment. We can define some tokens in some files of our project (in web.config in our case) that will be overwritten by the values defined in the release template. For example, we will change the server IP and the database connection for all three environments.

So, let's create two configuration variables, one for server and one for connection string. Choose after installation as replacement mode and limit the file extension filter to *.config.

[caption id="attachment_144" align="alignnone" width="1036"]Create Release Template - 5 Create Release Template - 5[/caption]

Let's start configuring the deployment sequence for Dev stage. Drag the server node and drop into deployment sequence. Then, drag the brand-new component into the server.

[caption id="attachment_147" align="alignnone" width="1036"]Create Release Template - 8 Create Release Template - 8[/caption]

Double click on the component to view it. The configuration variables will be shown in order to be filled. Fill them with the right information. In our case we have three websites configured in IIS, each of them with a different port and a different folder. We also want to create three different databases.

[caption id="attachment_148" align="alignnone" width="1036"]Create Release Template - 9 Create Release Template - 9[/caption]

In order to deploy correctly our website, we need to make one more step. We need to copy a folder from its original location to another one. To do that, we will use an item of release toolbox called Copy File or Folder.

Go to the toolbox and expand Windows OS node. Drag Copy File or Folder node and drop after the component just configured.

[caption id="attachment_149" align="alignnone" width="1036"]Create Release Template - 10 Create Release Template - 10[/caption]

Double click on the item and configure the variables.

[caption id="attachment_150" align="alignnone" width="1036"]Create Release Template - 11 Create Release Template - 11[/caption]

So now we've created the deployment sequence for Dev environment. In our case, the deployment sequences for the next two environments will be pretty the same, only the configuration variables will change.

Right click on Dev stage and select Copy Deployment Sequence.

[caption id="attachment_151" align="alignnone" width="1036"]Create Release Template - 12 Create Release Template - 12[/caption]

Right click on QA stage and select Paste Deployment Sequence.

[caption id="attachment_152" align="alignnone" width="1033"]Create Release Template - 13 Create Release Template - 13[/caption]

We will be asked to map servers when we paste a deployment sequence from one stage to another. In our case, we only have one server, so the mapping is very easy.

[caption id="attachment_153" align="alignnone" width="1036"]Create Release Template - 14 Create Release Template - 14[/caption]

We are close to deploy the application! We only need to create the token file and to configure a build that fires a deploy. Let's start with the token file.

Go to your solution and copy web.config file. Rename the file to web.config.token. Change the string you want to tokenize to the configuration variable's name, starting and ending with a double underscore.

[caption id="attachment_160" align="alignnone" width="1920"]Create Release Template - 21 Create Release Template - 21[/caption]

Before creating the new build definition, we have to upload an specific Build Template to TFS. You could find the template in this location: C:\Program Files (x86)\ Microsoft Visual Studio 12.0\ReleaseManagement\bin. If you want add the release management features in an existing build template, please refer to Release Management User Guide.

We could create now the new build. Create a new Continuous Integration build based on ReleaseDefaultTemplate template and with Release Build parameter set to true.

[caption id="attachment_154" align="alignnone" width="1920"]Create Release Template - 15 Create Release Template - 15[/caption]

And that's all we have to do. Make a change in your code, check in pending changes and when the build finishes we can see how our application is travelling through the release path.

Go to Releases -> Traffic Overview. Take a look to your release path. You could see there's one App in traffic. Depending on how you have configured the release path, you will need to accept some steps or not. In our case we have to accept all the intermediate steps.

[caption id="attachment_155" align="alignnone" width="1036"]Create Release Template - 16 Create Release Template - 16[/caption]

Go to Releases -> My Approval Requests. Refresh the view until you see an approval request. If you have configured mail notifications, the approver will receive an email.

[caption id="attachment_156" align="alignnone" width="1036"]Create Release Template - 17 Create Release Template - 17[/caption]

Approve all the notifications.

[caption id="attachment_157" align="alignnone" width="738"]Create Release Template - 18 Create Release Template - 18[/caption]

When the notification to deploy to production arrive (all the other deployments are automatic) you have to specify a little more information.

[caption id="attachment_158" align="alignnone" width="762"]Create Release Template - 19 Create Release Template - 19[/caption]

And finally the traffic overview will look like this.

[caption id="attachment_159" align="alignnone" width="1036"]Create Release Template - 20 Create Release Template - 20[/caption]

As you can see, the application has traveled through all the release path. Now we can open our favorite web browser and take a look at the three web sites.

[caption id="attachment_161" align="alignnone" width="931"]Create Release Template - 22 Create Release Template - 22[/caption]


And that's all for today. Enjoy your holidays!!


Using different configuration per stage

In the [previous article](./deploy-serverless-app/) we saw how to create a basic deployment pipeline for a serverless application. In thi...… Continue reading

Deploying a serverless application

Published on April 19, 2018

Dynamic secrets with Vault

Published on December 16, 2017