Continuous Android Deployment with Bamboo and HockeyApp

November 25, 2013

Making and Distributing Builds Manually is Boring

At MichiganLabs, we like to automate away redundant/mindless work so we can focus on providing value to clients and working on the interesting and difficult problems.

One of the very common tasks we do is build software; sometimes to give to clients, sometimes to provide versions for internal testing, sometimes just to see if it will build. Deployment to mobile devices can be complicated by the number of different devices that need to have the app downloaded and installed. In addition, the use of Git provides effortless branching but it can be difficult to keep track of all the different branches and what is currently being tested.

Enter Bamboo…

Atlassian Bamboo is a great build server which has tight integration with our instances of Jira (issue tracker) and Stash (Git repository). Bamboo can be configured to automatically track all the branches in Stash and build them. The integration is great and it makes it easy to see the status of each build.

Followed by HockeyApp

Once a build is complete, it’s sitting on the Bamboo server with no one able to access it except through the web interface. It’d be nice if a user could download the latest beta or an internal tester could put down the latest version. One option would be to upload the binary to a web server but that doesn’t provide much in the way of authentication or authorization and it can be hard to track versions and branches. Often, we only want clients to see beta builds but internally we should see all feature builds as well.

HockeyApp is a great service similar to TestFlight that allows Android and iOS apps to be uploaded and distributed. They provided a mobile app for users to see the latest build and provide feedback. There are a few features that set HockeyApp apart from other services we’ve looked at:

  • Ability to tag builds to restrict who can see them
  • Programmatically add release notes which we use to add feature branch name and commit number to each upload

Our Configuration

Setting the Android Version using Maven

Our Android projects use Maven for dependency management and builds. Bamboo has a plugin which runs Maven targets, so importing them in was straightforward. One of the things we wanted to do was have the branch name included in the Android version string so that a user could easily identify what branch they had installed. We didn’t want to edit the AndroidManifest.xml manually for each build, so we turned to the plugin to update it.

Bamboo’s Maven targets is

clean android:manifest-update install -Dandroid.manifest.versionName=${bamboo.repository.branch.name}

The android:manifest-update tells Maven to update the local manifest before it builds and passing in the versionName property sets the value. Bamboo has quite a few environment variables that can be used through the build configuration, ${bamboo.repository.branch.name} is the branch name of the current build. Now, every APK that is generated has the branch name embedded right in it.

Uploading to HockeyApp

Atlassian advertises that their iOS Plugin supports uploading to HockeyApp but doesn’t mention anything about using it with Android. Fortunately, the upload task doesn’t verify that file being uploaded is actually an iOS archive, so the plugin can be used just fine with Android APKs. It’s as simple as entering the API key and adding the task to the build stage.

The plugin allows release notes to be provided. Here too, we make use of Bamboo’s environment variables to provide valuable information. Our current settings are

Branch: ${bamboo.repository.branch.name}

Commit: ${bamboo.repository.revision.number}

Future Enhancements

Automated Tagging

The HockeyApp plugin currently doesn’t allow automated setting of tags so we manually have to go in and set them when we want to release to clients. This works fine since it doesn’t take long to do. HockeyApp has a public api so we can add a stage in the Bamboo publish process at some point.

Joshua Hulst
Joshua Hulst
Co-founder & Managing Partner

Stay in the loop with our latest content!

Select the topics you’re interested to receive our new relevant content in your inbox. Don’t worry, we won’t spam you.

Bringing Agile Home
Miscellaneous

Bringing Agile Home

August 26, 2020

My life often resembles a game of Whack-A-Mole. The moment I complete one task two more pop up. To avoid getting behind, I jump on new tasks almost immediately. Then at some point along the way my wife will innocently ask if I’ve scheduled my appointment with the Secretary of State. Realizing that an up-to-date driver’s license takes priority over a squeaky hinge, I put down my tools and book my online appointment.

Read more
Drinks on the Deck 2022
Business

Drinks on the Deck 2022

July 19, 2022

Join us and ~250 other friends for Drinks on the Deck 2022. Come help us celebrate the new office in Ada. Free drinks & appetizers.

Read more
Michigan Software Labs Named One of the Country's Best Small and Medium Workplaces by Fortune copy
Press Release

Michigan Software Labs Named One of the Country's Best Small and Medium Workplaces by Fortune copy

October 16, 2020

Michigan Software Labs has been named as one of the 100 Best Small and Medium Workplaces based on an independent survey by consulting firm Great Place to Work® and Fortune Magazine. Michigan Software Labs came in 64 on the list.

Read more
View more articles