The Stash team recently released the Stash-Bamboo plugin, which surfaces pass/fail results from Bamboo builds inside Stash. The main use case for the plugin is to let people reviewing a pull request see whether tests are passing on the development branch before they give the thumbs-up for merging it into master. Pretty cool. So I asked Build engineering to install the plugin on the Bamboo instance we use to build and test Confluence. For now, Bamboo is configured to notify Stash only for “A1. Master Baseline” builds. We have a lot of builds for Confluence but not all of them are equals, so we split them in tiers in order to tailor developers reaction. The A1 tier is the most important one and must be green all the time. The plugin is definitely helpful when reviewing pull requests, but I discovered another benefit too. Since the build status icons tell you which commits are good, they can help you start your issue/feature branch on the right foot when you’re choosing which commit to branch from.
And so what?
If you’re lucky enough to never have branched from a bad commit, let me share with you how ugly it can be. You have worked on this new feature, the code has been reviewed and you are ready to push it to master for the world to see, but you see on Stash that the builds are red on your branch. You start checking the builds wondering how your change could have broken all these tests. After a while you realize these tests were broken on master when you branched, but since master is green now everything should be ok. You push your change and move on. After a while build wallboards start getting red all over the office with your face on it. You did break some tests after all… But all that pain can be avoided if you take care to branch from a good commit in the first place.
On the Confluence team, we don’t have a 1:1 mapping between commits and builds. So given that, the results need to be analysed a bit.
- Commit with failed builds : obviously you don’t want to branch from there
- This doesn’t mean that this particular commit broke the build. It could be caused by a previous commit build in the same time.
- Commit with green builds
- The more CI builds are exercising that commit, and the more of them that are green, the more reliable the commit is.
- For the Confluence team, 5 builds passed means all “A1. Master Baseline” builds passed, and you can branch
Thanks to the Stash-Bamboo plugin we can start your branch on the right foot, but it’s pretty much useless if you forget to check the build status before branching. One way to fix this problem for good is to use Bamboo Gatekeeper, letting Bamboo push branch changes to master once the tests are green. Or you could put a sticky note on your monitor to remind you… but I don’t recommend it.