Question

Trying to make my life easier, Currently we have 4 developers working in Visual Studio 2012 and we are using TFS 2012 for source control. The project we work on is a multi-tenant web application (single source directory with multiple dbs) that is a mixture of legacy, asp and vb6 com components, coupled with new C# code. We use TFS for source control and for managing User Stories and Bugs. Because of the way our site works it can not be ran or debugged locally only on the server. Source Control is currently setup with a separate branch for each developer that's working directory is mapped to a shared network path on the dev server that has a web site pointed to it in IIS. Dev01-Dev05 etc. The developers work on projects in their branch test it using their dev website, then check in changes to their own branch and merge those into the trunk. The trunk's work space is mapped to the main dev website so that the developers can test their changes against the other customer's dev domains to test against customizations and variances in functionality based on the specific dbs the are connected to.

Very long explanation but basically each dev has a branch and a site, that are then merged into the trunk with its own site.

In order to deploy our staging server:

  1. I compile the trunk's website via a bat file on the server
  2. Run a windows app I built to query TFS for changesets associated with specific WorkItems in a certain status, and copy all the files for those changesets from the publish folder to a deployment folder.
  3. Run another bat file on the server to use RedGate's Deployment Manager to create a package from those new files
  4. Go to the DM site on our network to create and deploy that release (haven't been able to get the command line tools to work for this, so I have to do it manually)
  5. Run any SQL scripts that have been saved off in Folders that match ticket numbers on each database (10 or so customer dbs) to support the release

I have tried using TFS automated build stuff and never really got it to build the website correctly. Played around with Cruise Control also with little success. Using a mishmash of skunk works projects to do this is very time consuming and unreliable at best.

My perfect scenario would be:

  1. Gated Checkin, Attempt build/publish every time a developer merges into the trunk, rejects and notifies developer if the build fails.
  2. End of the day collect the TFS Items of a certain status and deploys files associated with them to the staging site
  3. Deploy SQL scripts for those TFS items across all the customer dbs in staging
  4. Eventually* run automated regression UI tests, create new WorkItems or emails to devs if failed
  5. Update TFS WorkItems to new state so QA/Customers know their items are ready to test in our staging environment
  6. Send report of what items were deployed successfully

How can I get here so that I am not spending hours preparing and deploying releases to staging and eventually production? Pretty open to potential solutions, things that would be hard to change would be the source control we are using, can't really switch to subversion or something else so we are pretty stuck with TFS.

Thanks

Was it helpful?

Solution

Went back in and started trying to get TFS to build/publish my web solution. I was able to get a build to complete successfully. adding msbuild argument /p:DeployOnBuild=True and setting the msbuild platform to x86 seemed to do the trick on that. Then I found https://github.com/red-gate/deployment-manager-tfs which gives you a build process template to do the package and deployment using the redgate tools. After playing with that for a bit I finally got it to create, package and deploy my build to our staging environment.

Next up will be to modify the template to run some custom scripts to collect only the correct items to deploy, deploy all the sql files and then to set the workitems to the appropriate statuses after completion.

OTHER TIPS

Really detailed description of your process. Thanks for sharing!

I believe you can set up TFS to have gated check-in on a single branch, which if you can setup on trunk would make sure that the merges built successfully. That could trigger msbuild, if you can get that working or a custom build job.

If you can get that working then you'd be able to use that trunk code as the artifact to send to Deployment Manager. That avoids having to assemble the files for deployment through the TFS change sets, as you'd be confident that the trunk could always build.

Are you using Deployment Manager to deploy the database from source control as well as the application?

That could be a way to further automate the process. SQL Source Control and SQL CI allow you to source control the structure of a database, keep a database up to date on each check-in, and run database unit tests. They also produce database packages for Deployment Manager, so you can deploy a release that contains both the application and the database.

If you want to send me the command you're using in step 4 to deploy the release using Deployment Manager I can help out with that. The commands I use are:

DeploymentManager.exe --create-release --server=http://localhost:81 --project="Project Name" --apiKey=XXXXXXXXXXX--version=1.1
DeploymentManager.exe --deploy-release --server=http://localhost:81 --project="Project Name" --apiKey=XXXXXXXXXXX--version=1.1 --deployto=CI-Environment-Name

That will create a release version 1.1 using the latest available packages for that project. You can optionally specify the package to be used when creating the release with

--packageversion=<package name>=<version>
--packageversion="application=1.5
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top