iOS and Jenkins: How we use it

There are many blog posts out there that extol the virtues of setting up a Continuous Integration environment.  They claim it’ll make your life easier with promises of auto-building that includes testing, building, and distribution.

Prolific has done it as well – We can tell you that when it works, it’s a feat of sheer brilliance. However, when it fails (and it does!) it fails hard. And it usually fails at the worst possible times:

  • It fails because you updated your CocoaPods. (As a side note: if you’re not using CocoaPods to manage your third party frameworks, you should be.)
  • It fails because you updated your Java.
  • It fails because sometimes, it doesn’t feel like working.
  • We want to help you reduce this.

    This isn’t an article about how to setup a Jenkins automated build server. If you are looking to do that then you should look at these articles….

  • “Continuous Integration of iOS Projects using Jenkins, CocoaPods, and Kiwi” by 9elements
  • “Tutorial: Setting up a Jenkins Automated Build Server for iOS” by Brian Coleman
  • SO WHAT’S THE BEST WAY TO DO THIS?

    Every one of Prolific’s iOS engineers have had their turn wrestling with this, and we think with some trial and error, we have come up with a process that works for us.

    We mainly control Jenkins through the use of scripts because it becomes more maintainable, and each script can be stored in the projects’ repo.

    Also, what works well is the way we do provisioning. It saves us from having to update the provisioning profile every time their is a new device added to the list.

    SETUP

    Here’s the setup at Prolific:

  • We have a dedicated Mac Mini on the office Wi-Fi.
  • We are running the latest version of OSX 10.9.2 and the latest Xcode (5.1) as of this post.
  • We decided to use the OSX app version of Jenkins (aka Jenkins.app), to sidestep any issues we had with Jenkins requiring its own user, and the security hoops you have to jump through accessing the keychain for codesigning your apps
  • We use the Shenzhen Ruby plugin to build and distribute to our testers via HockeyApp.
  • Using Jenkins.app allows us to start/stop Jenkins and restart Jenkins by starting/closing the app. It opens the default web browser to the Jenkins dashboard at

    http://localhost:8080/

    The Jenkins dashboard is where we have a list of all of our projects that are building, otherwise known as jobs. We configure a project with these settings.

    Our source code management repo points to our online git space.

    - git@bitbucket.org:prolificinteractive/amazingiOSProject.git
    branch specifier - release

    Under the advanced options there is a setting called Excluded Regions. We want to exclude the plist of the project, so we write the path to the plist in this box, starting from the root. In this case, it would be:

    awesomeProject/AwesomeiOSTestProject/AwesomeiOSTestProject/AwesomeiOSTestProject-Info.plist
    Note: By adding the plist to the exclude list, Jenkins ignores this file and changing it doesn’t trigger anything. If you skip this step, you might cause your Jenkins to constantly build every time it checks for changes.

    We use a develop branch as our main git working branch. All Pull Requests are merged into our develop branch. When PR’s are done for the day, and code is ready for a build, a manual merge into the release branch from develop is done, which triggers a build. Jenkins is set to poll for changes on the release branch, so when someone merges into release that is enough to start Jenkins.

    SCRIPTS

    Everything that Jenkins performs is in scripts. At the root of our project, there is a Makefile that contains commands for Jenkins to run in succession.

    Each one of these make commands leads to a set of commands on the Makefile:

    build:
    cd ios; pod install;
    cd ios; Scripts/create_build.sh
    
    version-bump:
    cat "${plist}" | /usr/local/bin/node ios/Scripts/bump_version.js build > tmp.plist
    mv tmp.plist "${plist}"
    git commit -am "Bumps version"
    git push origin develop
    git checkout -B release origin/release
    git merge develop
    git push origin release
    
    distribute:
    cd ios; Scripts/distribute_build_hockey.sh

    Notice that the commands are in 3 sections:

  • Build
  • Version Bump
  • Distribute
  • Let’s go into each one:

    Build

  • Resets to the root of the project, and re-builds the CocoaPods library.
  • Triggers the create_build script.
  • ipa build --scheme AwesomeProject --config Release

    The create_build script builds an IPA file from the scheme specified with the configuration specified.

    Version Bump

  • Runs the script that pulls the current plist, obtains the latest version number, and increments by 1.
  • Commits the plist to the develop branch as well as the release branch.
  • Distribute

  • Calls the build_hockey script that distributes the build to test devices.
  • ipa distribute:hockeyapp
    --token 0$$$$$$Your$$$Hockey$$$TOken$$$$Here
    --markdown
    --notify
    --mandatory
    --notes "`/usr/local/bin/node Scripts/generate_changelog.js AwesomeProject-ios`"

    Again, we take advantage of the Shenzhen plugin. The above code instructs the plugin to send a build to the hockey app with the proper token, notify all testers that a new build is ready, and for the release notes use the changelogs from the commits.

    PROVISIONING

    Provisioning causes all sorts of problems with Jenkins. If you don’t have the proper certs/keys in your keychain, nothing will build, and you will get an odd error that states something about dependency issues. Once you know that is set, you need to keep the provisioning profiles up-to-date on your build machine as well. We do that manually and pull a new version into Xcode on the build machine whenever there is a change.

    Note: If you have an enterprise account, you can get away with making a wildcard provision that contains “*” and it should let you build for any app, and distribute to all test users.

    TROUBLESHOOTING

    This is the flow that works for us reliably and gives us the least amount of issues. However, like anything in life, it’s not perfect. And when there are issues, this setup allows for easy troubleshooting. When and if you run into an issue, you should go to the Jenkins workspace, open the Xcode file from the job, and try to build it there.

    Go to the root of the user in your Terminal and CD to

    {USER}/.jenkins/jobs/{NAME OF JENKINS JOB}/workspace/{NAME OF XCODE PROJECT}

    Open your Xcode project from there. Now you can troubleshoot from the project and get detailed errors from Xcode instead of relying on Jenkins. Once you get it to build successfully, you need to archive it from here. When you can archive from here, you know that Xcode is no longer a problem.

    At this point you can go back to Jenkins and see if the issues are fixed. If you don’t feel comfortable yet, you can CD up a few levels to where your Makefile is stored, and call the commands manually from the commandline.

    make build

    Run the build command manually to test if it works. If you have issues here, it might be with getting the proper parameters setup to build using Shenzhen. A common issue here is not sharing your scheme from Xcode’s manage Scheme Dialog window.

    This is the workflow that we have found makes the most sense to us when using Jenkins to automate builds and distribute to our test users. There are many ways to implement this process, and we hope sharing this with you has been helpful to understand how the process can work.

    Prolific, after going through these steps.

    • Greg Boland

    Automatic Android Released!

    Welcome to Link

    Prolific is excited to have partnered with the great team at Automatic to help develop their app for Android, which provides users the ability to wirelessly connect their car and smartphone. Automatic worked to create a app that would be true to the style Android users are accustomed to, resulting in a clean user interface and a great user experience, something Prolific is proud to have been a part of!

    Users simply plug the Automatic Link device into their car’s data port (aka diagnostics port), and their car and smartphone will automatically connect whenever they are driving. Automatic speaks to the car’s onboard computer and links to the user’s phone and GPS functions via Bluetooth LE to upgrade the car’s capabilities. Automatic provides the user with data that will assist in small changes in driving habits that will lead to huge savings for the user.

    Automatic’s Features Include:

    Automatic assists you in learning about your driving style, giving you audio cues when you do things that cause inefficiency.

    Rough Braking

    Braking abruptly decreases fuel efficiency and dramatically increases wear-and-tear on your car’s brake pads.

    Speeding

    Highway speeding may not save you much time, but driving 10 MPH over the speed limit reduces fuel efficiency by 12-15%.

    Rapid Acceleration

    Stepping hard on the gas pedal decreases fuel efficiency and wastes money.

    Drive Score

    Automatic scores your driving every week to help you improve. A high score could save you hundreds on gas every year.

    Trip Timeline

    The Automatic app displays detailed info about your week, like how much you drive and where. See the actual MPGs for all your trips, even for older cars that don’t display fuel efficiency on the dashboard. Automatic also detects* fill-ups and even tracks local gas prices to show you how much you’re spending.

    The Automatic Android App

    A few favorite features of the Android app from members of our San Francisco dream team,  Matt Luedke and Vince Mi, who helped Automatic with development:

    User Interface

    Completely custom user interface displaying all the information you would need in a simple and fun format. Even customize the color of the car and scroll bar!

    Main Loading Page

    Customized loading page with parallax animation, adding an element of storytelling while explaining app features.

    Nearby Help

    Check on your engine’s health and receive a diagnosis of the exact problem, and find nearby mechanics in seconds.

     

     

     

    Prolific Post April 2014

    We’ve Been Busy:

    Dash releases its Android app in time for SXSW

    Dash Android

    Prolific is proud to announce the release of Dash for Android. A Prolific Accelerator company, Dash partnered together with Prolific to create and launch their Android app by “wheels down” for SXSW. We had a friendly wager that Prolific could produce an amazing app in record time. Needless to say, Prolific won! (We’re waiting for our Dash cash, Jeff! Any denomination is fine by us.) If you are an Android user and have been waiting for the app, get it now and start enjoying the ease and speed that Pay with Dash provides for dining out.

    New Partners to Prolific

    Couchsurfing

    Announcing a new friend and partner to Prolific! We’re happy to be adding Couchsurfing to our roster of partners. We’ve joined forces to get all the Android users out there an amazing app to make finding a place to crash a breeze.

    Jaclyn Longo, Paul Campagna, Dan Sullivan, and Pat McGann put their nerd faces on at Brooklyn Bowl

    Hustle at Work and at Play

    DUMBO P’s Hit the Lanes and Let Loose!

    The entire DUMBO office headed out to the Brooklyn Bowl last Thursday to strut their stuff and show off some mad skills. Let’s just say that we have some closet bowling masters in our ranks! Highest score goes to the amazing Kevin Bui with a total of 182, and the lowest score, and possibly new record-low, goes to Keyana with a total of 43 (for both games, at least she’s consistent). The team celebrated Bui’s victory with more games at Brooklyn Whiskey, where we dominated the Skeeball tables.

    San Francisco P’s Host a Happy Hour and Open House

    While the DUMBO P’s were at Brooklyn Bowl, the San Francisco office had their own fun with an open house and happy hour where anyone in the SoMa startup community was welcome to stop by for a drink and chat. Next for the San Fran P’s: a trip to the Aziz Ansari show and some boots of beer and German cuisine. Way to make us proud, SF team!

    Max Mamis, Engineer

    Happenings and Travels

    SXSWi 2014  - We Went, We Saw, We Conquered

    All the P’s returned safely from SXSWi this month, having met a lot of new friends and seen some pretty cool things. Check out our blog post about SXSW with tips, tricks, and all the gory the details.

    #McConnelling Shout Out from Jon Stewart and the Daily Show!

    Our very own Max Mamis and co. created an outstanding cultural gem, “Making #mcconnelling even easier,..” raved the Daily Show via twitter. Check it out for yourselves and stay tuned for other amazing and hilarious phenomenons from Max and the other Prolific P’s.

    Matt Luedke, Engineer

    PRWeek Awards

    Prolific’s Dan Healy was proud to serve as a member of the Judging Panel for the 2013 PRWeek awards. We were in great company with folks like our old pal Mike Germano, CEO of Carrot Creative and CDO of VICE Media. It was a great evening surrounded by very talented and creative minds from some of the world’s leading brands. Prolific wants to congratulate all the winners again on their achievements! Check out the full list here.

    Snow*Mobile 2014

    Our very own Matt Luedke attended Snow*Mobile 2014 this past month and had some very smart things to say about it! Topics from iBeacons to GoogleGlass were covered and Matt felt like King of the North while trying to keep warm in Madison. Read all about that and Matt’s insights on our blog.

    Prolific’s Extending the Family!

    Russ Wallace, SF Managing Director

    Our very own Russ Wallace is growing up and got ENGAGED! Congrats Russ and Amy! Amy, not sure if Russ told you, but you’re now stuck with the entire Prolific crew. Way to go, Russ, she’s a catch!

    Coming Up:

    Prolific’s 5th Birthday

    Prolific is turning 5. Yep, we can’t believe it either! April 17th is our birthday, feel free to stop by and say hello, have a drink, or drop off a present, we are down for whatever.

    Type Tees

    Type Tees, a Prolific Accelerator Company, will be launching this month! This exciting endeavour is in partnership with Threadless whose iOS app is Powered by Prolific and launched earlier this year. Check back on our site to hear all the details and download Type Tees!

    Prolific In the News!

    We know, we’re basically famous now. Check out some great articles featuring us, DUMBO, and Threadless:

    TechCrunch had the exclusive on the Threadless iOS release. Read what they had to say about Threadless, Prolific, and the importance of community.

    Internet Retailer outlined How Threadless sewed up a top spot in Apple’s App Store featuring our very own Bobby Emamian and Threadless CEO Jake Nickell.

    PRWeek highlighted the agencies and tech companies that have us all in a DUMBO State of Mind.

    We’ve Added To Our Roster

    New P’s in DUMBO!

    Caitlin O'Connell, Account Manager

    Please help us welcome Caitlin O’Connell, the latest addition to the Prolific Account Team, and Tyler Shick, the newest Designer with an amazing amount of talent! Welcome to the Prolific family!  Keep an eye out for a blog post by them soon to hear more about their first few weeks as a Prolific P!

    Jealous? Don’t be! We have a few spots open here at Prolific as the family is growing rapidly! Check out our hiring page for all the juicy details!

    What’s New with Our Friends:

    Our pals at Dash and Pay with Dash, a Prolific Accelerator Company, are moving their offices to the Big Apple. We know not everyone can be die-hard DUMBO fans like us, but we will miss them! As they grow and continue to revolutionize the way we all dine out, we wish them much luck in their transition. We are also immensely proud to have seen them make their small screen debut! Check them out on Bloomberg and FOX! Looking good boys!

    Tyler Shick, Designer

    The awesome team at Acustom Apparel took home the awards at the Fashion 2.0 Awards. Prolific attended the event and it was great to see such great companies win big. Congrats to all the winners!

    Our partners at Lululemon embraced being highlighted on Jimmy Kimmel, as he covered: celebrity baby names, their latest and greatest pant, and a partnership with Johnson and Johnson.

    The geniuses at ModCloth have done it again, brilliance! Here is how to truly rock your favourite toupee.

    Gif of the Month

    One last gem for you…

    Jaclyn Longo sums up the past month with her weird but intoxicatingly jubilant dancing.

     

     

    Prolific Survived SXSWi 2014

    A few Prolific P’s headed out to SXSW for Interactive week. We covered a lot of ground and saw some pretty cool things. Here’s a snapshot of our behind-the-scenes learning at this year’s SXSW.

    3 Takeaways from Snow*Mobile 2014

    A couple weeks ago, I had the opportunity to pack up, fly over to Madison, Wisconsin, and attend Snow*Mobile 2014. I lived in Madison for several years (as did several other Prolificos). I first learned how to code there, had great startup experiences… the whole deal. So it’s great to go back whenever I can get the chance. (Not to mention the great food and beer!)

    • Matt Luedke