2

We have separate TFS 2012 branches setup for each environment (DEV/QA/PROD).

Changes are checked-in to DEV branch which triggers a release via RM for Visual Studio 2013 Update 4 to the DEV server.

Current release template has Build Definition from DEV branch selected, but we need to switch to QA/PROD branches when moving to the next stage.

Do we need to create separate templates for each stage, instead of using a single template with all stages included?

user2966445
  • 1,267
  • 16
  • 39

1 Answers1

8

RM was built on the idea of binary promotion instead of branching per stage. The idea is to have one set of binaries that you promote from one stage to the next. This makes the release process faster (no extraneous builds are happening) and decreases your QA time -- if you test the functionality of the code in QA, then rebuild for production, you're releasing untested binaries into production. It also helps with repeatability. If a release fails between QA and Prod with a branch-per-environment model, you potentially have extra answers to the question "Why did this work in one environment and not the other?". The only answer to that question should be "because there's a problem with the environment". It should never be "because we botched a merge".

You should reevaluate your branching strategy such that you build and release out of one branch, instead of relying on multiple builds out of multiple branches.

That said, your approach of creating separate release paths and templates for each branch would be the best way to tackle it if you can't mess with your branching strategy at the moment.

I usually do something like this, assuming DEV -> QA -> PROD:

Dev branch goes to a dev environment. QA branch goes to a QA environment. Prod branch goes to a QA environment, then to prod.

This lets developers continue working on new features while the previous release is being stabilized. If you take this approach, you'll pretty quickly realize that the QA branch is extraneous -- you build for release, then test the thing that you're intending to release.

Once you hit that point, it's a short path to realizing that it's best to keep dev branches short-lived, relying on frequent merges of new features from dev to trunk. Longer-running changes that aren't ready for public consumption can be isolated behind feature flags, so you can continue to roll out smaller changes that are feature-complete and tested while longer-running development work is still taking place.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • What about hotfixes that are completed in a separate branch from "Main" (i.e. Release branch)? For instance, if a pending release in Main is being QA'd and a hotfix needs to be completed today via Release branch. Is a separate Release template needed for the Release branch with duplicate Configuration Variables? – user2966445 Aug 19 '15 at 00:05
  • You should always release from the same branch. – Daniel Mann Aug 19 '15 at 00:07
  • If new enhancements are pending in Main and not fully tested, should they be backed out for the hotfix? – user2966445 Aug 19 '15 at 04:30