Automate all the things: release branches

Written by Luit van Drongelen on 30th June 2017

I love building small, useful tools using Go. A while ago I built a small tool to cut release branches. At first, some colleagues were confused about why we would need this, or confused about the new process. That took two or three weeks. In the year that followed we had zero confusion about release branches.

Ambiguity and tensions

Before this tool I made was used, there would be somebody who deployed a release branch to our staging environment, who would have to cut the release first. The process we had, stated on which day this should happen but gave no guarantees about the time, or it even happening on that day. I often heard the question go around asking whether the release branch had been made yet. Or somebody asking for the release branch to be held off for a bit, to quickly merge something to the develop branch beforehand.

Documenting deployment steps on a Monday meant finding out whether the branch had been made yet to find out which week they would have to be executed. Writing the changelog depended on the deployer of the release branch too, which was often a source of tension for them.

Meet Dave

Because of the aforementioned difficulties with the process I proposed somebody else created the release branches at set times, pulling this burden from the deployer, better serving the developers and changelog author. But nobody really wanted to do this… except for Dave.

Every Monday morning at 6 Dave wakes up, looks at the currently available release branches, calculates the next version, and cuts a new branch from develop with that version in the branch name. After this, he goes back to sleep for the rest of the week. He’s been doing this for 14 months now, without fault. The developers can depend on the release branch being created on Monday morning at 6, the changelog author can depend on the release branch being there before he enters the office, and Dave doesn’t really ask much in return. That’s a win for pretty much everyone, I think.

How he gets the job done

As I mentioned, I love building small, useful tools. Dave is a great example of why I often use Go when I do. To cut a release, Dave does the following:

  1. Look at all current release branches
  2. Calculate the next minor release version based on this list
  3. Find the commit currently referenced by the develop branch
  4. Create a release branch with the information from steps 2 and 3

To do this, Dave will have to interact with our Git repository. The easiest way to do this was through GitHub’s API, because there’s a great client library for Go. Add an OAuth2 library and a personal access token and you’re ready to poke around. Add some code to parse version numbers and you have Dave.

Save yourself time

If you want to use Dave’s services too, go ahead and find him on GitHub. I think he can spare the time to cut your releases too.

Your thoughts

No comments so far

Devhouse Spindle