Using Cocoapods with Xcode Bots
I just finished setting up builds using Xcode bots this morning for our app which uses cocoa pods, however I will say that we are going to stick with Jenkins. So far my impression of bots is that they are meant for people who have never done CI before. They are EXTREMELY limited in capability (can’t monitor a build as it’s happening, build env can’t pass parameters to the build such as build numbers, can’t run scripts pre/post build etc, can’t administer a list of people allowed to download your test app, Xcode build list not auto-refreshed when new build is run, etc).
Looks like the only thing you can do is what you can add to your build scheme, and the only feature benefit is Xcode integration (which sucks so far, was not even able to create a bot in Xcode, had to use web page) so you can link from automated test runs to source code. Neither of these warrant moving from Jenkinsish/Testflight solutions.
All that is why we are NOT converting to bots, but if you want to use cocoa pods with bots here’s what I had to do:
- go through the voodoo of setting up os x server and Xcode automation
- create home folder /var/teamsserver for _teamsserver user if it doesn’t already exist
- make sure to set proper ownerships on /var/teamsserver to _teamsserver account
- add .ssh with keys that can access your local pod repo to /var/teamsserver
- Set up new schemes specifically for Xcode bots
- edit scheme / build / pre-action add a bash script (or other script, your choice) that does something like
- if ~/.cocoapods/repos/localrepo does not exist, pod repo add your local repo
- if Pods folder does not exist pod install, else pod update
- share and check in the scheme
- Go http://yourserver/xcode and create the bot.
- create bots via xcode server web page… Xcode never let’s you get past authentication settings even when it shows them correct (this may be because we don’t allow HTTP urls on our github server, only ssh, so our url looks like git@ourserver.com:Team/App)
Fairly short list of steps, but OS X server docs were no help at all.
I’m really hoping this is just the starting point for bots, and that they will get a lot better in the future. Currently, even though jenkins is a much more complex CI server, I found myself pulling my hair out less setting up Jenkins than I did Xcode bots. Jenkins also supports something called a config matrix so you can run multiple build configs on a single checkout.
BTW, here's what my build pre-action script looks like:
cd $SRCROOT if [ ! -e "$HOME/.cocoapods/repos/OurRepo" ] then pod repo add OurRepo git@ourgithub:OurApps/CocoaPodSpecs.git fi if [ -e "Pods" ] then pod update else pod install fi