Thursday, January 17, 2008

Advanced Multi-Stage Continuous Integration

In parts 1 through 3 of this series, I described how Multi-Stage Continuous Integration can be used at a team and multiple-team level. In this post, I will describe how Multi-Stage CI can also encompass other development stages.

The Development Hierarchy
So far, we’ve split the mainline up into a hierarchy of branches. Each developer has their own workspace and is part of a team, each team has its own branch, and each team branch is based on and merges back to an integration branch, which may be the mainline. Sometimes work is organized at a feature level instead of at a team level. For simplicity, I’ll just refer to teams. Each part of the hierarchy corresponds to a stage of development. This hierarchy enables multiple parallel development pipelines where changes move from a low level of maturity to a higher level of maturity and the work in the parallel pipelines is continuously integrated.

We’ve covered three stages of development: individual developer coding, team integration, and full project integration. But there are many more stages in a typical project lifecycle, even when you are doing Agile development. Traditionally, the stages of the lifecycle occur in several different places including project plans, the SCM system, and the issue tracking system. This adds development stages such as: code reviewed, system tested, UAT passed, demoed, etc. Each of these stages can be added as a branch to your branch hierarchy.

When using Multi-Stage CI, unlike the typical use of branches, changes do not linger on a branch any longer than required to pass through the stage that branch is associated with. The difference between any given branch and its parent in the hierarchy cycles rapidly between almost nothing and nothing. The goal is to push changes through the hierarchy as rapidly as possible.


When working within a development hierarchy, the impact of any given change is limited in scope. If there are 4 members on a team, then only 3 other people are affected when a change is merged into the team branch. Because changes are made on the team branch only when the developer has things working in their own version, changes at the team level are made less frequently and have a lower probability of destabilizing the build. Once the team branch is considered stable, changes are then merged into an integration branch which consolidates the work for multiple teams. Again, changes are made less frequently and have a lower probability of destabilizing the build. Thus, the graph at the integration level shows fewer changes and the changes are smaller. As you proceed towards the root of the hierarchy, changes are less frequent and less likely to destabilize the build until finally you reach the root where you have code that is always shippable.

Getting Started
Getting to Multi-Stage CI takes time, but is well worth the investment. The first step is to implement Continuous Integration somewhere in your project. It really doesn’t matter where. For a recommendation on an excellent book on Continuous Integration, see the bibliography. The next step is to implement team or feature based CI. Once you have that working, consider automating the process. For instance, you can set things up such that once CI passes for a stage, it automatically merges the changes to the next level in the hierarchy. This keeps changes moving quickly and paves the way for easily adding additional development stages.

I’ve seen Multi-Stage Continuous Integration successfully implemented in many shops and every time the developers say something like: “I never realized how many problems were a result of doing mainline development until they disappeared.”

Next: It is Better to Find Customer Reported Problems As Soon As Possible

5 comments:

Mike Coon said...

Good explanation and a better approach - I think - than just setting up a CI box and compiling on every check-in. Builds should work at least in the developer's workspace before being exposed to the rest of the team. It seems that sometimes folks just use the CI build as their smoke test.

Mike

xpier said...

It sounds like what Henrik said about Version Control in InfoQ, http://www.infoq.com/articles/agile-version-control
Is it difference?

It's about code integration, what about knowledge integration?

Damon Poole said...

Hi Xpier,

Yes, it is very similar. That is a very good article, thanks for pointing it out!

DinaTucson said...

Outsourcing IT projects can accelerate time-to-market for products and services. With outsourcing providers handling development, maintenance, and support tasks, companies can streamline their processes and reduce development cycles. This faster time-to-market enables businesses to seize opportunities ahead of competitors and capture market share. If you are interested in this service – use this link to source and find more!

tech Virat18 said...

OpenStack is an open source platform that uses pooled virtual resources to build and manage private and public clouds.