Click here to Skip to main content
14,973,198 members
Articles / DevOps / TFS
Article
Posted 15 Sep 2016

Tagged as

Stats

13.9K views
3 bookmarked

Release Management with Team Foundation Server 2015

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
15 Sep 2016CPOL9 min read
Creating releases and deployments using Team Foundation Server 2015

Introduction

In this article I intend to follow on from my previous articles on using Team Foundation Services (TFS) 2015 and focus on creating releases and deployments. My previous articles can be found below. If you haven't already read them then feel free to do so before continuing with this article.

The aim of this article is to follow on from my previous articles which gave you an introduction to setting up and configuring Team Foundation Services (TFS) 2015 and then adding unit tests to ensure that your code is correct. The next logical step would be to deploy your software once it has been built and tested.

For the purposes of this article I will configure a very simple release and deployment strategy that auto-releases each new build into your development testing environment. You obviously wouldn't want this for a QA or production environment, but more on that later. So whereas in my first two articles we created a Continuous Integration (CI) pipeline, in this article we will create a Continuous Delivery (CD) pipeline by continuously deploying our software to our development testing environment.

Just to be clear on terminology, what I am specifically referring to when I use the term development testing environment is a testing environment for the sole and exclusive testing purposes of the development team. It is not intended for any other person(s).

Background

It is assumed that the reader has some basic knowledge of Team Foundation Services and of the basic principles of building and releasing software. Reading my previous articles would help with this greatly.

Releases and Deployments

Before we get down to creating our releases and deployments, we firstly need to understand what these are. Another term we will also need to understand is environment.

  • Release - refers to the set of build artefacts that are created after a build. They reside within TFS so are not at this stage actually deployed anywhere. Therefore they represent candidate deployments i.e. a complete set of build artefacts that could be deployed if necessary.
  • Environment - refers to the endpoint of where we wish our release to be deployed e.g. QA environment, Production environment, Development environment etc. These can be endpoints located on the local network and / or in the cloud e.g. an Azure instance.
  • Deployment - refers to the act of pushing the release to the specified environment or endpoint as necessary. In our example our environment will be to a development testing environment.

Release Management in TFS therefore consists of two tasks:

  1. Create a release
  2. Deploy the release to a specified environment

Creating a Release

By clicking the RELEASE menu item from the top menu of your TFS dashboard you open the Release Explorer dashboard. It is from here where you will create your release and deployment for the currently selected project. You will be presented with a list of any currently configured Release Definitions as well as the releases created from those Release Definitions.

To begin with click on the plus (+) sign above the Release Definitions

Image 1

You will be presented with a list of deployment templates to choose from. For the purposes of this article I will select the Empty template, but feel free to select any of the other templates as necessary.

Image 2

Click the OK button to proceed. You will now be presented with an empty Release Definition and associated Environment as in the screenshot below.

Image 3

  1. Give your Release Definition a meaningful name in the textbox provided e.g. Development Release
  2. Configure your environment
    • Give the environment a meaningful name by clicking into the Default Environment name provided and enter one of your own e.g. DEVELOPMENT, QA, PRODUCTION.
    • Click on the ellipsis next to the environment name and select Deployment conditions...

Image 4

This is where we set up how we want our deployment to be triggered. It is here that we define what triggers the deployment of our release.

  • No automated deployment - deployment of the build artefacts will need to be undertaken manually with no automation
  • After release creation - this will deploy the build artefacts to the specified environment every time a new release is created i.e. Continuous Delivery.
  • After successful deployment on another environment - this will deploy the build artefacts to an environment after they have been deployed to another environment e.g. after every successful deployment to the STAGING environment deploy the build artefacts immediately to the QA environment

Use the first option if you are deploying to a production environment i.e. make the deployments to your production environment a manual exercise. Use the second option if you are deploying to a development testing environment as part of a Continuous Delivery pipeline. Use the last option if you want to push your deployments between different testing environments.

For the purposes of this article I will select the second option After release creation as I am deploying the build artefacts immediately to our development testing environment.

Just to repeat what I said earlier, a Release is not the same thing as a Deployment. A Release is a complete set of build artefacts that can be deployed to the specified environment. Whereas a Deployment is the actual act of pushing the build artefacts to the specified environment.

So in the example above, I have configured the deployment of the build artefacts to the development testing environment every time a release is created i.e. every time a build occurs (which is triggered by a code check-in), a Release is created and this is deployed to the development testing environment.

Although I am not setting up any Approvers for this particular article, it is worth exploring the Approvals tab. This is where you can configure who has the authority to approve or reject deployments to particular environments. For example you may want to seek the approval of the Software and / or Testing Manager or the Change Advisory Board if you are implementing a framework such as ITIL before a deployment.

Once we have defined the environment, we next need to add the necessary task(s) which will be invoked when we want to deploy our build artefacts to the specified environment. You can deploy your build artefacts to a server / virtual machine on the local network or to the cloud e.g. to an Azure instance. For the purposes of this article and to keep things simple I will deploy the build artefacts to a server on the local network. However, it is highly recommended that you investigate using the cloud for your testing environments.

Click on the Add tasks button to create our deployment task i.e. the action that we want to happen when we invoke a deployment.

Image 5

Select Windows Machine File Copy, click the Add button then click Close. Enter the necessary details as appropriate. An example screenshot is given below.

Image 6

Just to recap. Every time we trigger a build we create a Release. This is then automatically deployed to the development testing environment using the details we supplied as part of the deployment task above.

So far we have created our deployments automatically each time a release is created. Whilst this is great for our development Continuous Delivery pipeline, it's probably not something we want to do in our testing or production environments. For those environments we want to deploy manually on an ad hoc / scheduled basis rather than automatically.

Creating a Manual Deployment

To do this we repeat the previous steps for Creating a Release but make a few subtle changes.

Click the OK button to proceed. You will now be presented with an empty Release Definition and associated Environment as in the screenshot below. Give it a meaningful name e.g. PRODUCTION.

Image 7

When we configure our environment we use the No automated deployment option whereas previously we selected the After release creation option.

Image 8

As we are now deploying to a production environment, it's a good idea to define approvers who have the authority to approve the deployment into a production environment.

Image 9

When we define our release task we enter the details of our production environment whereas previously we entered details of the development testing environment.

Image 10

So that's the Release Definition for our production environment defined. The last steps now are:

  1. Create a release using the production environment Release Definition we have just defined
  2. Deploy that release to the production environment

Select the PRODUCTION Release Definition and click on Release and Create Release.

Image 11

Enter a meaningful description as this will appear in the list of releases when complete. Select the build you want to use as the basis for the release from the Artifacts dropdown. Presumably this will be the latest build but choose whichever build as necessary. Click on the Create button to proceed and create the new release.

Image 12

The next step is to deploy the release. This will deploy the release to the PRODUCTION environment defined earlier. We can see in the screenshot below that the bar under the Environments column is grey. This will change to green once the release has been deployed.

Image 13

Double click on the release to open the deployment details page. From here we can finally deploy our release. Click on the Deploy dropdown and select the PRODUCTION environment we defined earlier.

Image 14

We are now finally able to deploy our release by clicking on the Deploy button. This may take a few minutes depending on the size of the release and the endpoint to where you are deploying the release (your network latency if deploying to the local network or your internet speed if deploying to the cloud for example).

Image 15

Assuming everything went without error you should see that the deployment status has turned green indicating that the release has been successfully deployed.

Image 16

Summary

That's all there is to it. At its core the process is pretty straight forward. My suggestion would be to get the basics working first, and then add further steps later as needed. For example, adding approvers to your production deployments is a good idea. It's worth spending time looking around the various options that are available to see if you can make use of any of them in your own development pipeline. Feel free to leave a comment if you would like me to further elaborate on anything within this article.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Dominic Burford
Technical Lead Gold-Vision CRM
United Kingdom United Kingdom
I am a professional software engineer and technical architect with over twenty years commercial development experience with a strong focus on the design and development of web and mobile applications.

I have experience of architecting scalable, distributed, high volume web applications that are accessible from multiple devices due to their responsive web design, including architecting enterprise service-oriented solutions. I have also developed enterprise mobile applications using Xamarin and Telerik Platform.

I have extensive experience using .NET, ASP.NET, Windows and Web Services, WCF, SQL Server, LINQ and other Microsoft technologies. I am also familiar with HTML, Bootstrap, Javascript (inc. JQuery and Node.js), CSS, XML, JSON, Apache Cordova, KendoUI and many other web and mobile related technologies.

I am enthusiastic about Continuous Integration, Continuous Delivery and Application Life-cycle Management having configured such environments using CruiseControl.NET, TeamCity and Team Foundation Services. I enjoy working in Agile and Test Driven Development (TDD) environments.

Outside of work I have two beautiful daughters. I am also an avid cyclist who enjoys reading, listening to music and travelling.

Comments and Discussions

 
QuestionRe-Deploy Pin
David Michael Benjamin Jr.16-Mar-17 8:13
MemberDavid Michael Benjamin Jr.16-Mar-17 8:13 
AnswerRe: Re-Deploy Pin
Dominic Burford16-Mar-17 10:03
professionalDominic Burford16-Mar-17 10:03 
GeneralRe: Re-Deploy Pin
David Michael Benjamin Jr.12-Apr-17 4:43
MemberDavid Michael Benjamin Jr.12-Apr-17 4:43 
GeneralRe: Re-Deploy Pin
Dominic Burford12-Apr-17 5:12
professionalDominic Burford12-Apr-17 5:12 
PraiseVote - 5 Pin
Roelof ZA19-Dec-16 2:01
professionalRoelof ZA19-Dec-16 2:01 
GeneralRe: Vote - 5 Pin
Dominic Burford19-Dec-16 4:02
professionalDominic Burford19-Dec-16 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.