views:

186

answers:

2

There are several/many questions regarding TFS branching strategy, but I am haven't been able to come up with a strategy that fits with my scenario. My TFS project consists of a single solution that contains a Web Project, a Business Layer Project, and a Data Layer Project. The project is a portal of reports. Reports are largely isolated in subfolders within the project. There are however some features across the entire project such as session management. Over a given period of time, the workflow may occur as follows:

  1. Stable snapshot of code.
  2. Development of Report A begins.
  3. Development of Report B begins.
  4. The project with the inclusion of Report A needs to be pushed to our qa environment.
  5. The project with the inclusion of Report A and Report B needs to be pushed to our qa environment.
  6. The project with only the inclusion of Report B needs to be pushed to our prod environment.

So basically, each report is on a completely independent timetable. I need to be able to independently publish a branch of code to our different environments. Currently, we don't have branching - we just don't add a link to a new feature if the project gets published when a report isn't ready but is included in the project. Not the best scenario.

My initial go at a branching strategy was to have Main sit between the QA and prod environments, basically as just a container to merge before branching to a production branch for a production publish. Each report would be developed on a branch from main. For both our test and qa environments, a branch from main would be created and the appropriate development branch(es) would be merged into this "proposed updates" branch. This doesn't work though because I am merging development/feature branches into a branch that isn't the parent branch. I can't have Main at this level because a Report may be in development for weeks while another may be on a timetable that has it developed and pushed through the process to production in only a few days. My "proposed update" branches for test and qa need to be able to be independently created from a merging of only the appropriate dev branch(es).

My only experience with branching/merging is a main+dev pair of branches, so I'm very out of my element here. How can I setup my branching in such a way that I am able to merge features in on independent timetables without getting stuck and code being published to an environment before it is ready?

If it matters, we are on TFS 2008 right now and hope to go to TFS 2010 soon. This is an immediate need to get going on our current TFS 2008 server though.

+1  A: 

I'm not exactly clear on everything; reading comprehension and all.

As I understand it, your current process is Dev -> Test -> QA -> Production. Devs work on code, push it to an environment where they can test on it. Once satisfied, they push it to QA, and when code passes it moves into production.

In addition, you have several "teams" (1 or more devs) that must work on separate reports, each of which must eventually be moved through the above process into Production. Teams may be working on code that is distinct from all others, or teams may find they cannot move their code forward until other teams reach stability.

If I were in charge of branching for this solution, I would recommend the following.

First, create a Production branch. This branch only contains production code. Only your QA team touches this branch.

Next, create a QA branch. This branch is also maintained solely by QA teams. They manually merge test code into this branch, run their quality assurance tests, then merge with Production. Every time they merge with Production, or test code is accepted into QA, a label is applied to the branch. If test code fails, the branch is reverted back to the prior label.

Development teams manage their own branches. They are created by branching from QA at the latest label. This assures they are working with the latest approved code. Developers work with and test on this branch. If teams have a dependency on each other, they should work on the same branch, unless it becomes clear that creating secondary branches from their shared Dev branch would be easier. Once a Dev branch meets the milestones set for the developers, QA should be informed that the branch is ready for merging with QA for testing.

Alternatively, depending on how complex development is, you might even consider uniting the QA and Production branches. Often, it is a simple matter to add a label to a branch to indicate a stable, production worthy build. It also keeps the branching strategy as simple as possible, which is always a good thing.

Will
@Will, I'm not sure this would help with the fact that if the QA branch has 2 new features into it, only 1 new feature should be promoted to production.
rchern
@rchern Well, that depends. Branching into and out of the QA branch should be atomic. Otherwise, how can you test one team's work when another team's work is mixed in midway in testing? You either have to make separate branches of QA which must be merged prior to QA being merged with production, or queue up dev branches waiting for QA. This isn't necessarily an issue with branching/merging, its more about process. Note, you can always do a "reverse integration" where you can reintegrate the QA branch (updated from dev team 1) with a QA branch testing dev team 2's work.
Will
@rchern BTW, MS' "ALM Rangers" might be a good resource for you. Here's their 2010 guidance http://tfsbranchingguideiii.codeplex.com/ which still applies (somewhat) to 2008; I'm sure if you contacted them they would be glad to help if you have questions you cannot seem to get sufficient answers for.
Will
Yeah, I've gone over the Branching Guides. Regarding multiple QA branches: Yes, but again I'm in a scenario where I want to merge with a branch that isn't that branches parent/child branch.
rchern
@rchen the solution may be prevention in that case. Do you think you could implement a more rigorous control of branching in your organization?
Will
A: 

I think you should look at the Branching Guidance put together by the VS ALM Rangers.

http://tfsbranchingguideiii.codeplex.com/

This should alswer all of your questions. You are looking at quite an advanced branch plan. I also have some good practical guidance on my blog. I know that I am talking about Scrum teams, but it is basicaly Feature branching based on the Guidance.

http://blog.hinshelwood.com/archive/2010/04/14/guidance-a-branching-strategy-for-scrum-teams.aspx

If you get a chance please vote over at the new "Visual Studio ALM" StackExchange over in Area51 as we are trying to setup a place dedicated to answering these questions with the Visual Studio ALM MVP's and Visual Studio ALM Rangers on hand to answer your questions.

http://area51.stackexchange.com/proposals/15894/visual-studio-alm

MrHinsh
Your blog looks familiar. I believe my searching came across it a bit ago when I started researching this. My problem is that everything may not get promoted at the same time. Obviously I understand the benefit of that, but it is not applicable in my case. That's where all of these branching strategies break for me.
rchern
:) With TFS 2010 you get a visulisation to be able to promote changesets through the branches to promote only the code you want. It can be done with 2008, and is detailed in the Branching Guidance.
MrHinsh