Branching: do it like this and nobody gets hurt

Branching: do it like this and nobody gets hurt
It’s a very simple pattern. Make a Continuous Integration build for the trunk and the release branches. Most projects don’t need anything more clever than this.

5 thoughts on “Branching: do it like this and nobody gets hurt

  1. Douglas Squirrel says:

    We’re at most one release ahead of production, so we just have HEAD and the immediately prior release to run tests on; one of our projects releases frequently enough that we don’t even have to branch it at all normally. The three projects share a server farm, with several CruiseControl instances running different types of tests for each in rotation, so we’ve just inserted the branches as new projects in the rotation. Since changes to the branches are rare, other projects don’t often have to wait for the branches. Since changes are well-vetted, we don’t run branched code through all the steps in the build pipeline, just the ones that are most critical (we skip browser-compatibility tests for example, since we rarely make substantial HTML changes in branches).

  2. Jon says:

    I totally agree! KISS rule goes a long way here.I wrote a little bit of ant/shell to handle automatic svn tagging based on whether a build was run against trunk or a branch.I can't post the antscript here (blogger paranoia!), but suffices to say it's pretty noddy. Just passes in the ${label} and ${checkoutdir} for the build.The bash bit:#!/bin/bash# Expects to be called by the tag.xml antscript. Needs to be told the working copy it's tagging from and the label to tag with.checkoutDir=$1label=$2svn_revision=`svn info ./${checkoutDir}|grep "Revision:"|awk '{print $2}'`svn_url=`svn info ./${checkoutDir}|grep "URL:"|awk '{print $2}'`echo ${svn_url} |grep trunk > /dev/null 2>&1if [ $? -eq 0 ]then svn_tag_url=${svn_url/trunk/tags}/trunk/else svn_tag_url=${svn_url/branches/tags}fiecho "svn autotagging ${svn_url} at revision ${svn_revision} for build ${label}…"svn copy -r ${svn_revision} ${svn_url}/ ${svn_tag_url}/${label}/ -m "cruise: Autotagging for build ${label}(Revision: ${svn_revision})."echo "svn autotagging complete."I'm sure there's a more elegant way to do it though 🙂

  3. tea42 says:

    Branches? Unless its a transitional release (rc1, rc2, etc.) shouldn’t you be releasing tags?

  4. Julian says:

    Douglas, Jon. Thanks for your comments. I think I want to do a longer post on this topic.Tea42: Yes, tagging/labelling is necessary to identify the exact code that’s running in prod. But IMO you need a branch so you can only release production bugfixes and enhancements and not mainline development as well.

  5. […] September: Branching: do it like this and nobody gets hurt […]

Comments are closed.

%d bloggers like this: