iOS Continuous Delivery with Go - The Setup

I've been working on getting a Continuous Delivery workflow setup using Go (no not Golang, Go by Thoughtworks).

To say that it has been a painful experience would be an epic understatement.

I felt that sharing my experience might makes things easier for anyone else looking to setup something similar. This post covers the initial setup, but if I have time (and I remember) I'll publish a follow up.

Setup Go Server

Setting up Go Server was pretty straight forward (naturally went with Digital Ocean).

# Install prerequisites
apt-get install openjdk-7-jre-headless unzip git

# Get package
wget http://download01.thoughtworks.com/go/13.4.1/ga/go-server-13.4.1-18342.deb

# Install package
dpkg -i go-server-13.4.1-18342.deb  

At that point, you'll be able to connect to the Go web UI.

Configuring Authentication

The next step was to configure authentication (since by default it's disabled). Go seems to lean towards using an LDAP server for auth, but that's overkill for my use case, so I'll have to use a password file instead.

# Create the password file
touch htpasswd

# Add a user (will be prompted to enter password)
htpasswd -s /opt/goci/htpasswd <username>  

Building an iOS App

Getting to this point has been fairly painless, but here's where things began to get murky.

Approach 1 - Using xcodebuild

I spent many fruitless hours tying to coerce Go in driving the xcodebuild tool. Ultimately, I ended giving up and moving onto xctool where I finally had a breakthough.

In hindsight, the issues was probably the same one that I initially had with xctool (i.e. not usually manually created schemes), although I haven't bothered trying.

Approach 2 - Using xctool

For reasons I can't explain, Go won't accept arguments to xctool in the way that you'd expect.
This won't work - Thoughtworks Go

After many frustrated attempts I stumbled upon this blog post which included a number of alternative ways to specify custom commands.
This does work - Thoughtworks Go

I had to call bash and pass in the commands as arguments to that.

Command: /bin/bash
Arguments: -c /Users/administrator/tools/bin/xctool -project myapp.xcodeproj/ -scheme automated -sdk iphonesimulator build

What's Left?

  • Provisioning Profiles and Certificates
  • Building the IPA
  • Uploading to HockeyApp
  • OCLint Integration

Resources

Applying Continuous Deployment to iOS Apps
Building iOS Applications with Go 2.0
Travis CI for iOS
MacStadium (Mac Dedicated Servers)
OCLint (Static Code Analysis)