One of the few things that can add true agility to the Agile practices that you claim to do is Automation. – “AUTOMATE EVERYTHING YOU CAN!”
In my current project we have successfully automated our application deployment process. To us, deploying the ‘latest’ or an ‘already compiled revision’ of the build to the desired environment (Integration/QA/UAT/Prod etc) is just a click away. This encourages the team to deploy quickly, frequently and fearlessly.
This post will have us take a look at how to automate your application deployment using Microsoft Team Foundation Server (TFS). I am assuming that you are familiar with TFS and Team builds. Needless to say that you should have a Build Server (Build Controller, Agents) up and running. We will extend CI build capabilities of TFS to deploy our builds continuously to the integration environment. Assuming that you have the Build Controller and Agents in place, the first thing we might want to do is setup a basic CI build on the Build Server, selecting Continuous Integration as the build trigger. This will setup our out-of-the box CI Build Service using TFS.
The CI build definition we created is good enough to compile builds, run tests, deploy databases (if configured) and drop the builds to a specified location every time we check-in code. But what we want to do here is extend this build definition in a manner that in addition to doing all of the above; it will also go ahead and deploy the application on the web server.
Here is how we do it,
1. Right click on the CI build-definition in team explorer.
2. Select “Process”
3. Expand “Advance” node, if not already expanded
4. In the ‘MSBuild Arguments’, provide the following parameters,
/p:MSDeployServiceUrl=<name of the Server>
/p:DeployIisAppPath=<IIS App>/<Virtual Dir>”
And, there you go – simple, yet powerful. Try it out in your projects; you might be pleasantly surprised with the results.
Any discussion about Agile and Build Automation is not complete it without a mention of Continuous Deployment and Continuous Delivery. Continuous Deployment is about shipping out every feature developed by the team through the Deployment Pipeline all the way to the production in an automated fashion. Continuous Delivery is having a human intervention somewhere in the Deployment Pipeline to before making the feature available to the users.
These techniques are really about taking your agile practices to the extremes, both in terms of potential and performance. But, even if you don’t intend to get there immediately, it would still be unthinkable as to why wouldn’t you start automating things that you need to be doing as often as needed and as accurate as possible – Build Deployment definitely being one of them.