Artificial Intelligence

Continuous Delivery for Enterprise on iOS

In part two (part one) of a series on iOS automation, we'll discuss continuous deployment.


In part two (part one) of a series on iOS automation, we'll discuss continuous deployment. Thankfully, due to wonderful tools like Hockey, it’s never been easier. In this post, we’ll go over installing the native Hockey app on your server, configuring its associated command line utility, and setting up a post-build trigger that will automatically upload your XcodeBots build and release it on Hockey.

Prerequisites

You'll need a Bot that builds enterprise (or ad-hoc) signed builds. We went over how to accomplish that at length in the first part of this series. You'll also still need all the prerequisites mentioned in that post, quoted here to save you a click:

This post is assuming that you’re using OS X Yosemite, OS X Server 4, and Xcode 6. If your project has CocoaPods dependencies, you’ll need to install that on your CI server as well.

Installing Hockey App and Configuring the CLI

From your OS X Server box, download and install Hockey for Mac. You can optionally sign in once you've launched the app, but it won't be necessary for our purposes. Visit the app’s preference panel (⌘+,), and click Install on the command line helper.

Set Application up on Hockey

If you don't already have one, click New App from the Hockey dashboard (You can create it manually if you don't have a build ready just yet). Once your app is created, or if you already have one, move on to the next step.

Set up an After-Integration Trigger

From your existing XcodeBot, select Edit Bot… and press next until you arrive on the final screen. There, press Add Trigger then Run Script under “After Integration.”

Thankfully, our Hockey command line helper does most all of the work from here, we just need to launch it. Here's a simple script to do so (new lines added for readability):

#!/bin/bash
/usr/local/bin/puck -submit=auto -download=true -notify=true -notes="Daily Build" -api_token=<YOUR_API_TOKEN> -app_id=<YOUR_APP_ID> "$XCS_ARCHIVE"

Here's a breakdown of the arguments we're using:

-submit
We need auto here, manual is a non-starter for automated deployment.
-download
Whether or not we want testers to be able to download this build.
-notify
Whether or not testers should receive a notification email when the upload finishes
-notes
Simple Release notes to be attached to the build
-api_token
Generated here (login required).
-app_id
From the application’s Hockey page

The Hockey command line helper has a whole host of other options documented here for the curious.

The final argument ("$XCS_ARCHIVE") is an ENV variable set by XcodeServer that identifies the path to the .xarchive folder created by your bot. Because we're uploading the entire archive, we get desymbolication of every build our bot uploads for free! If you've integrated the Hockey SDK into your app for crash logging, all the crash logs your testers upload will have fully symbolicated stack traces.

Finalization

Once your script is entered, make sure that it’s marked to only run on success. Press Update. The next time your integration runs, your build should automatically upload to Hockey and be downloadable by your testers. Assuming you've got the HockeySDK integrated with your app and that you've incremented your build number, all your testers will be prompted to update the next time they launch the app.

Similar posts

Get notified on new marketing insights

Be the first to know about new B2B SaaS Marketing insights to build or refine your marketing function with the tools and knowledge of today’s industry.