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.

Development Practice Lead, Josh Friend on What's Possible in Technology
Business

Development Practice Lead, Josh Friend on What's Possible in Technology

December 12, 2019

As the Development Practice Lead at Michigan Software Labs, I’ve had the unique opportunity to have a small role in most of the digital products that we develop for our clients. This has given me the perspective that nearly anything is possible when it comes to what a client wants to develop - technology is rarely the barrier stopping progress.

Read more
Download a collection of 3 key articles on the state of digital today
Business

Download a collection of 3 key articles on the state of digital today

April 14, 2020

As presented by Forbes. Download the top-3 most popular articles published by Michigan Software Labs.

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

Michigan Software Labs Named One of the Country's Best Workplaces by Fortune

August 9, 2021

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 79 on the list. This is the second year the company has won the prestigious award.

Read more
View more articles