Whether you have a formalized process that's tailored to your business, or you've chosen one of the Microsoft-provided ALM models within Team Foundation Server, or your process is seemingly ad hoc, it’s worth re-examining your software development lifecycle (SDLC) every once in a while. Integrating Windows Azure IaaS into your development and test process can help you deliver on-time and high-quality code. With the RightScale cloud management platform, you can integrate your existing toolset – TFS included – to build, publish, and deploy test environments with ease, reduce your on-premise IT overhead, and speed up your development and test cycles. This post is the first in a three-part series that I will be writing on DevOps. You can also join me for an upcoming webinar where I’ll present a live demo that will touch on many of the topics I cover here.
Generally an SDLC follows the path of an issue from requirements (whether it's a new feature request or a defect) through to the development process and then out the door into the wild. If you can map a process around how you're managing the flow of information and how you gather and codify it, you can make sense of how your team is doing – or maybe just how you’re doing yourself.
I glossed over a lot of detail in the process I just described, but for the sake of this discussion I want to focus on one glaring omission: I neglected to even mention the role of testing. The practice of testing, at both a bench-test level and in a formalized QA role, is generally not as robust as anyone would like for it to be, for a number of reasons. There are never enough hours in the day, story points in the sprint, or resources on the bench for you to feel comfortable when you’re working on complicated updates. Many organizations still struggle without a properly maintained test environment. Still others are without a lab or a set of machines for developers to get their hands on in order to put together meaningful tests outside of each developer's machine.
If your shop finds itself in a similar position, I have three tips on how to produce accurate, consistent, and reliable tests and test environments for your team.
1. Use the Heck Out of MSBuild
Most of us know of MSBuild as the build engine behind Visual Studio. It's what runs when you press F5 or you rebuild your solution. It sits in the .NET installation folder under your c:\windows\Microsoft.NET folder, and that’s all most developers ever think about it. However, MSBuild provides an awesome set of documentation on the functions included in its XML-based scripting language, as well as a ton of pre-made extensions to the process, along with a way to extend the base set of tasks and targets yourself.
That may sound daunting, but it's not rocket science. If you have a manual process that you go through to build and deploy your solution, chances are you can leverage MSBuild to handle the vast majority of the tasks you want to take care of. Some of the go-to tasks I use MSBuild for include:
- Detokenizing config files with new values per environment based on inputs
- Zipping up a directory and robocopying it to a specific archival directory
- Executing SQL scripts for database updates
Automating your dev build and deploy process is key to making the most of "crunch time" for your test process. Visual Studio gives you a starting point with the project files it creates for you, which can serve as a great way for you to start to understand how to build custom MSBuild scripts. You can find the full set of information on the base MSBuild tasks on MSDN. The MSBuild Extension Pack documentation is on CodePlex, and a help file is packaged with the task DLLs as well as on the MSBuild Extension Pack site.
2. Get Agile with Windows Azure Virtual Machines
Once you’ve automated as many tasks as you can with MSBuild, you can automate the implementation of your test environment. Taking your workload to Windows Azure Virtual Machines helps by commoditizing testing resources and enabling you to deploy entire infrastructures in isolated, secure environments where you can test your applications.
The key here is that you can create and destroy infrastructures on demand, so you're only paying for utilization and you don't have to predict the capacity you need ahead of time. Spinning up another environment is only a matter of provisioning it in the Windows Azure dashboard – and adding RightScale to the process makes it so that there’s no need to perform OS installs, patches, and other time-consuming tasks such as installing SQL Server or configuring IIS. You don’t even need to log into the machine itself to have a fully running configuration of your application.
3. Automate Deployment with RightScale
The final step is to automate your infrastructure deployment beyond just the instantiation of your servers by using a strong automation framework to manage post-boot operational processes. Much like MSBuild automates the compilation and code process around your Visual Studio projects, PowerShell can automate management at a server level.
Leveraging PowerShell within an automation framework such as RightScale lets you create consistent, repeatable, and maintainable environments within your cloud deployment. The key is in a RightScale construct called the ServerTemplateTM, which wraps a cloud-based image and allows you to extend and build upon the existing image to automate the installation or configuration of whatever services and applications you need.
This combination of image (VHD) and script management lets you automate even the most complicated deployments. The key is starting with the right base image (Base ServerTemplate for Windows, Database Manager for SQL Server or the Microsoft IIS Application Server) and filling in the gaps for your application from there.
Put It All Together
Using the deployment method within RightScale, you can create cloneable templates of your virtual machines to be spun up on demand and deployed as necessary. If you automate your build and upload your file packages directly to Windows Azure storage, it's easy to retrieve and deploy an application within IIS or even restore your development database on demand within SQL Server. With all this in place, even if you lack as much time as you’d like, you can test early and often and increase your test coverage and review quality while reducing your dependency on in-house hardware availability and maintenance issues.
Windows Azure's Virtual Machines and the automated provisioning capabilities within RightScale make a killer combination for unlocking on-demand test environment productivity. In a future post I'll cover some of the nuts and bolts of automation within the rapid test and validation process, including some specific MSBuild bits, and I’ll go over some PowerShell basics on deploying and managing servers from an application developer's perspective.
As I mentioned earlier, I’m also planning a webinar to demo some of the key points in this process using Visual Studio, Team Foundation Services, Windows Azure Virtual Machines and RightScale. I hope you’ll sign up and join me on April 10.