Skip to main content

Team Service & TFS - Release Management and Multiple Environment Support

I was impressed to discover a new feature on Team Service and TFS 2015 - Release Management.
Release Management allow us two things that can improve our release procedures:
  • Define multiple environments and push the binaries (content) from one environment from another
  • Request manual approve before pushing the packages from one environment to another
Environments Definition
Once the CI finish the build, we can specify in what environment we want to push the output. Once the content is pushed to a specific environment, we can run any kind of steps, from simples once like Integration Tests to more complex one, where people interaction is required. 
Team Service support us to define one or more release definitions. Each release definitions represents the tasks that needs to be run on each environment. It can be a simple script that change a version, or adding/removing content from the build. In the end can be any action that needs to be executed when we deploy content to a specific environment.  

From one another we can push the content to another environment once:
  • The build is with success 
  • Time scheduler
  • Success of a previous deployment
The nice thing is that we can add a new environment directly from the UI. For each env. we can specify what are the tasks that we want to execute. Don't forget that once you defined an environment it might be more easily to clone the current environment and modify it based on your needs. Usually, at steps that needs to be executed on each environment there is a delta, but you might have some steps that are common.

On top of this we can deploy in the same time the output of a build or from another environment to one or multiple environments. This means that you can deploy in two env. (QA and Pre1Production). A similar thing that can be done on the other side - push the package to an env only of we are 'green' on multiple env.

For each environment we can have variables. In this way we can have different configuration for each separate env. From the usability perspective, the nice thing is that the list of variables that are defined contains also the value for all environment. In this way it is very easy to check or to compare what values are set.
From the security perspective, we are allowed to specify what users or group of users has access to each env. In this way you can have the dev. env. where only devs can access it n QA env. where only the testing team can access it. And so on other environments. 

Manual Approve
There are times when you cannot configure an automatic mechanism to deploy from one env. to another. Very often, you need a person that decided if a build goes to pre-production for example. Or you need to QA Lead to decide if the current build that is deployed in the QA Environment can go to the next environment or not.
For this kind of scenarios, we are allowed to specify that there is a need of a manual release approval. A list of persons or a group needs to be specified. This persons can approve a deployment before beeing push to it or after is deployed (pre/post-deployment approve).
In this way we can ensure that only if a specific person approves a release, the content is pushed to Pre-production or even to Production environment. 

On top of this you can specify a list of people that needs to approve the action. The options in this case are:
  • Any one user
  • All users in sequential order
  • All users in any order
In this way you can map any process flow and gates over it.

From a DevOps point of view, more and more features are added to TFS each month. With features like this, even complex flows and procedures can be mapped easily.


Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

GET call of REST API that contains '/'-slash character in the value of a parameter

Let’s assume that we have the following scenario: I have a public HTTP endpoint and I need to post some content using GET command. One of the parameters contains special characters like “\” and “/”. If the endpoint is an ApiController than you may have problems if you encode the parameter using the http encoder.
using (var httpClient = new HttpClient()) { httpClient.BaseAddress = baseUrl; Task<HttpResponseMessage> response = httpClient.GetAsync(string.Format("api/foo/{0}", "qwert/qwerqwer"))); response.Wait(); response.Result.EnsureSuccessStatusCode(); } One possible solution would be to encode the query parameter using UrlTokenEncode method of HttpServerUtility class and GetBytes method ofUTF8. In this way you would get the array of bytes of the parameter and encode them as a url token.
The following code show to you how you could write the encode and decode methods.

Entity Framework (EF) TransactionScope vs Database.BeginTransaction

In today blog post we will talk a little about a new feature that is available on EF6+ related to Transactions.
Until now, when we had to use transaction we used ‘TransactionScope’. It works great and I would say that is something that is now in our blood.
using (var scope = new TransactionScope(TransactionScopeOption.Required)) { using (SqlConnection conn = new SqlConnection("...")) { conn.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = conn; sqlCommand.CommandText = ... sqlCommand.ExecuteNonQuery(); ... } scope.Complete(); } Starting with EF6.0 we have a new way to work with transactions. The new approach is based on Database.BeginTransaction(), Database.Rollback(), Database.Commit(). Yes, no more TransactionScope.
In the followi…