Releasing, Branches, and Agile Teams
When Brad Appleton and I wrote the SCM Patterns book we discussed two branching patterns related to releasing software: Release Line and Release Prep Codeline. The first, is a pattern that allows teams to easily support released code. The second is a pattern to help you “stabilize” a codeline before a release while allowing parallel work for the next release to proceed. Too often teams start Release Prep Codelines at the wrong time or for the wrong reasons, without understanding the costs . Given the rate at which changes happen on agile codelines, the costs of creating a branch can be large if do it for the wrong reasons.
If an ideal agile team had “shippable” software at the end of every iteration, a Release-Prep codeline isn’t necessary. You just label your code at the end of the final sprint, and if you need to provide a fix that can’t be done from the mainline code, you start a release branch from that label.
Many teams can’t ship at the end of every sprint, creating a Release Prep Codeline (branch) is a useful: it avoid some poor alternatives, like having a code freeze. The branch can receive small changes to fix problems, and the mainline can add new features, refactor, and integrate the fixes from the release-prep branch.
As the time between when the branch is created and the project is released grows, the cost of merging changes between the branch and the Mainline increases because the source code diverges. This decreases the velocity of the team and can make the time to release grow more.
A long interval between branching and release often happens for reasons like:
- Quality issues. There are a lot of problems, so going from “feature complete” to “shippable” takes longer than expected.
- “Code Freeze” happens before “Feature Freeze.” Not explicitly, but after the branch is created you identify new “must-have” features. This gets worse as the time between branch and ship increases.
So what is a team to do? Here are some suggestions:
-
Be agile and prioritize: If the release is the most important task, do that work on the mainline, and have everyone work on it. Don’t branch until you are ready to ship.
-
Add automated tests early. Try to be “ready to ship at the end of the sprint,” so you can avoid the costs of branching.
-
Don’t branch until you really are feature complete, and use the Release-Prep Branch only for a constrained set of fixes.
If you really need to start future work before the current release is ready to ship consider either:
-
Doing all work on the main line and isolate “future work” by architectural techniques. (Make new features plugins, for example).
-
Keeping the work that is highest priority on the main line, and create a Task Branch for the future activity. Those on the task branch are responsible for merging main line code into their branch, and when the release is done, the task branch get copied to the main line.
My tendency is to want to keep the highest priority work on the main line as long as possible. Usually the code you are about to release meets this criterion.
Technically, these are simple technical approaches to implement. Like all SCM issue, there a are many non-technical issues to address. Product owners need to understand the costs of “working in parallel” and an agile team is responsible for making sure that the product owners know these costs so that they can make the correct decisions about when to start a parallel work effort.
How has your team addressed pre-release and release branches? If you read this and have an opinion, please comment!