360iDev OTA Distribution and Build Automation
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

360iDev OTA Distribution and Build Automation

on

  • 4,543 views

 

Statistics

Views

Total Views
4,543
Views on SlideShare
1,269
Embed Views
3,274

Actions

Likes
1
Downloads
10
Comments
0

10 Embeds 3,274

http://skabber.com 1957
http://harrisonjackson.us 1098
http://skabber.github.com 110
http://lanyrd.com 58
http://localhost 33
http://news.google.com 4
http://feedwrangler.net 4
http://posterous.com 4
http://webcache.googleusercontent.com 4
http://skabber.com.netzcheck.com 2
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Hello and welcome to Over the Air Distribution and Build Automation.\nI will be showing a fair amount of code during this presentation. You don’t need to type it out.\nAll code will be available online after the presentation at http://skabber.com\n
  • My name is Jay Graves and you may recognize me from Sky Mall, Maxim, etc.\nBut when I am not jetsetting around the world as an International Male Model...\nI am the CTO of Double Encore (This is our website here)\n
  • My name is Jay Graves and you may recognize me from Sky Mall, Maxim, etc.\nBut when I am not jetsetting around the world as an International Male Model...\nI am the CTO of Double Encore (This is our website here)\n
  • My name is Jay Graves and you may recognize me from Sky Mall, Maxim, etc.\nBut when I am not jetsetting around the world as an International Male Model...\nI am the CTO of Double Encore (This is our website here)\n
  • My name is Jay Graves and you may recognize me from Sky Mall, Maxim, etc.\nBut when I am not jetsetting around the world as an International Male Model...\nI am the CTO of Double Encore (This is our website here)\n
  • What is OTA distribution?\nIn the old days you would have to ship a build to a customer, walk them through dragging and dropping into iTunes, syncing their device. It was very problematic.\nNow we have the ability to install an app...\nWithout tethering and syncing with iTunes. The user simply taps on a link and the app is installed wirelessly.\n
  • What is OTA distribution?\nIn the old days you would have to ship a build to a customer, walk them through dragging and dropping into iTunes, syncing their device. It was very problematic.\nNow we have the ability to install an app...\nWithout tethering and syncing with iTunes. The user simply taps on a link and the app is installed wirelessly.\n
  • What is OTA distribution?\nIn the old days you would have to ship a build to a customer, walk them through dragging and dropping into iTunes, syncing their device. It was very problematic.\nNow we have the ability to install an app...\nWithout tethering and syncing with iTunes. The user simply taps on a link and the app is installed wirelessly.\n
  • Xcode comes with the ability to save builds that deliver OTA already.\nThey just hide it under the word “Enterprise”\n
  • I will show you how all this works now.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • This is a lot of steps!\nIt is a pain to do over and over again when you are rapidly developing an app and want to get the latest version on many devices.\nWhat do we do when something is a pain to do over and over again.\n
  • Automate it.\nXcode is a big IDE with lots of bells and whistles in order to automate it were probably going to want to use shell scripting.\nLuckily Apple thought of that and gave us /usr/bin/xcodebuild\n
  • Using xcodebuild from the command line you can build any Xcode project/scheme/workspace/configuration/target for whatever architecture and SDK your machine supports.\nIt’s very powerful.\nThere is a lot here.\n
  • But it is also very easy to simply build app.\nJust give it the Target name and Configuration name.\nYou may not even have to do that if you only have one Target and a default Configuration set in your Xcode Project.\n
  • So if we can do all that from the command line what is the switch to save for "Enterprise"?\nThere isn't one :(\n\n
  • So if we are going to create our own build for "Enterprise" script we need to know more about what those files that are created.\n
  • So if we are going to create our own build for "Enterprise" script we need to know more about what those files that are created.\n
  • So if we are going to create our own build for "Enterprise" script we need to know more about what those files that are created.\n
  • Lets start with the .ipa What is an .ipa file?\nIt is just a .zip file with a Payload directory that contains your .app\n\n
  • Lets start with the .ipa What is an .ipa file?\nIt is just a .zip file with a Payload directory that contains your .app\n\n
  • Here you can see GroupA.zip\nIt has a root directory name “Payload”\nInside that is our .app\n
  • Find the compiled .app\nCreate the Payload directory\nCopy recursively the .app into Payload\n Zip the Payload directory into our new .ipa file.\n--\nThat was easy, ok what about this .plist file?\nLets see what it contains\n\n
  • Next is the property list.\nThe property list outlines the URL location of the .ipa along with app icons and some meta data about the app.\nOf course we all know that property lists are just XML files\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • So how shall we script the building of this .plist file?\nPython? Ruby? Perl? \nYou could use any of those but Xcode comes with its own plist command line tool.\n\n
  • PlistBuddy to the rescue!\nPlistBuddy can be found at /usr/libexec/PlistBuddy\nIt be run as an interactive .plist editor or be scripted with individual commands.\n\n
  • PlistBuddy to the rescue!\nPlistBuddy can be found at /usr/libexec/PlistBuddy\nIt be run as an interactive .plist editor or be scripted with individual commands.\n\n
  • Variables will be defined at the top of the script.\nI have the script available online and after the talk for everyone.\n
  • Once we have the .ipa and the .plist creaged we need to get them uploaded somewhere\nAmazon S3, FTP, SCP, ???\n
  • Think of all the other things you could do at this point.\n
  • Think of all the other things you could do at this point.\n
  • Think of all the other things you could do at this point.\n
  • Think of all the other things you could do at this point.\n
  • Think of all the other things you could do at this point.\n
  • Think of all the other things you could do at this point.\n
  • Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  • Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  • Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  • Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  • Thats great, but how do we get this to run when there is new code to be distributed?\nGet the final url in here. Gist?\n--\nSo this is great, but we are still running this command line build every time we want to distribute an OTA build...\nSo what are we going to do.\n
  • Git to the rescue!\nUse git to check the local revision of master to remotes version of master\nthen pull & build if they are different.\n\n
  • Git to the rescue!\nUse git to check the local revision of master to remotes version of master\nthen pull & build if they are different.\n\n
  • Git to the rescue!\nUse git to check the local revision of master to remotes version of master\nthen pull & build if they are different.\n\n
  • Git to the rescue!\nUse git to check the local revision of master to remotes version of master\nthen pull & build if they are different.\n\n
  • Set that up via a cron job to run every min and you have a really simple automated build server.\n
  • Demo the cron job building when a commit happens.\n
  • We have gone from an entirely manual & tedious build for “Enterprise” workflow,\nto a completely automated system that once you have set up you don’t even have to think about it.\n\n
  • We have gone from an entirely manual & tedious build for “Enterprise” workflow,\nto a completely automated system that once you have set up you don’t even have to think about it.\n\n
  • \n
  • Jenkins is a Continuous Integration Server.\nIt is really powerful.\nJenkins can help you build and monitor multiple projects\ndistribute builds across multiple machines\narchive your build products .ipa dSYM files\nrun unit tests\nshow CLANG static analysis results\n
  • This is the DE Jenkins server\nWe have 45 Builds being monitored.\nJenkins makes it really easy to set up a farm of machines.\nYou can see here that we have 1 Master and 3 Slaves\n
  • Super easy to install using Brew.\nA quick note about Brew. Similar to MacPorts. Install Open Source Software the “Mac Way”\nReally easy to start\nor\nYou can use launchctl\n
  • Super easy to install using Brew.\nA quick note about Brew. Similar to MacPorts. Install Open Source Software the “Mac Way”\nReally easy to start\nor\nYou can use launchctl\n
  • Super easy to install using Brew.\nA quick note about Brew. Similar to MacPorts. Install Open Source Software the “Mac Way”\nReally easy to start\nor\nYou can use launchctl\n
  • \n
  • Double Encore has built or own internal front end App that lists all the available \napps we can install from Jenkins.\n
  • \n
  • \n

360iDev OTA Distribution and Build Automation Presentation Transcript

  • 1. OTA DISTRIBUTION &BUILD AUTOMATION Jay Graves Double Encore © 2011 Double Encore, Inc.
  • 2. © 2011 Double Encore, Inc.
  • 3. © 2011 Double Encore, Inc.
  • 4. © 2011 Double Encore, Inc.
  • 5. © 2011 Double Encore, Inc.
  • 6. © 2011 Double Encore, Inc.
  • 7. What is OTA Distribution? © 2011 Double Encore, Inc.
  • 8. What is OTA Distribution? © 2011 Double Encore, Inc.
  • 9. What is OTA Distribution? © 2011 Double Encore, Inc.
  • 10. XCODE © 2011 Double Encore, Inc.
  • 11. XCODE © 2011 Double Encore, Inc.
  • 12. DEMO © 2011 Double Encore, Inc.
  • 13. THE HARD WAY © 2011 Double Encore, Inc.
  • 14. THE HARD WAY 1. Build and Archive 2. Share Archive 3. Use .ipa + Provision profile 4. Name the .ipa 5. Save for “Enterprise” 6. Upload files 7. Use the magic URL © 2011 Double Encore, Inc.
  • 15. © 2011 Double Encore, Inc.
  • 16. AUTOMATE IT! © 2011 Double Encore, Inc.
  • 17. AUTOMATE IT! /usr/bin/xcodebuild © 2011 Double Encore, Inc.
  • 18. HELP! © 2011 Double Encore, Inc.
  • 19. BUILD IT xcodebuild -target MyApp -configuration Release © 2011 Double Encore, Inc.
  • 20. WHAT IS THE “ENTERPRISE” SWITCH? © 2011 Double Encore, Inc.
  • 21. WHAT IS THE “ENTERPRISE” SWITCH? © 2011 Double Encore, Inc.
  • 22. BUILD OUR OWN © 2011 Double Encore, Inc.
  • 23. BUILD OUR OWN ? © 2011 Double Encore, Inc.
  • 24. BUILD OUR OWN ?1. A .ipafile2. A .plistfile © 2011 Double Encore, Inc.
  • 25. CREATE A .IPA FILE MyApp. ipa © 2011 Double Encore, Inc.
  • 26. CREATE A .IPA FILE zip MyApp. © 2011 Double Encore, Inc.
  • 27. © 2011 Double Encore, Inc.
  • 28. SCRIPT IT © 2011 Double Encore, Inc.
  • 29. SCRIPT IT# Create the .ipaAPPFILE=$(find . -name MyApp.app)mkdir Payloadcp -r *.app Payload/zip -r MyApp.ipa Payload/ © 2011 Double Encore, Inc.
  • 30. PROPERTY LIST © 2011 Double Encore, Inc.
  • 31. PROPERTY LIST © 2011 Double Encore, Inc.
  • 32. SCRIPT IT lyn © 2011 Double Encore, Inc.
  • 33. SCRIPT IT ? lyn © 2011 Double Encore, Inc.
  • 34. SCRIPT IT ? Perl Ruby Python © 2011 Double Encore, Inc.
  • 35. © 2011 Double Encore, Inc.
  • 36. © 2011 Double Encore, Inc.
  • 37. PLISTBUDD © 2011 Double Encore, Inc.
  • 38. PLISTBUDD /usr/libexec/PlistBuddy © 2011 Double Encore, Inc.
  • 39. © 2011 Double Encore, Inc.
  • 40. TO THE INTERNET! © 2011 Double Encore, Inc.
  • 41. TO THE INTERNET!s3cmd --acl-public put ${ipa_name} s3://my-builds/s3cmd --acl-public put ${distro_plist_name} s3://my-builds/ © 2011 Double Encore, Inc.
  • 42. POSSIBILITIES © 2011 Double Encore, Inc.
  • 43. POSSIBILITIES 1. Archive your .dSYM 2. Send out an email 3. Tag your source code 4. Post to Twitter 5. >say “Build Complete” © 2011 Double Encore, Inc.
  • 44. FOUR STEPS © 2011 Double Encore, Inc.
  • 45. FOUR STEPS 1. Compile the .app 2. Create the .ipa 3. Create the .plist 4. Upload the files © 2011 Double Encore, Inc.
  • 46. SHOW FULL SCRIPT © 2011 Double Encore, Inc.
  • 47. AUTOMATE IT) © 2011 Double Encore, Inc.
  • 48. AUTOMATE IT) © 2011 Double Encore, Inc.
  • 49. AUTOMATE IT#!/bin/shgit remote updatelocal=$(git rev-list --max-count=1 master)origin=$(git rev-list --max-count=1 origin/master)if [ "$local" != "$origin" ]then    git pull origin master    echo "Lets build it :)"else    echo "No changes :("fi © 2011 Double Encore, Inc.
  • 50. CRON JOB* * * * * sh /usr/local/bin/build_project.sh > /dev/null © 2011 Double Encore, Inc.
  • 51. DEMO © 2011 Double Encore, Inc.
  • 52. THE STORY SO © 2011 Double Encore, Inc.
  • 53. THE STORY SO •Entirely manual workflow •Completely automated solution © 2011 Double Encore, Inc.
  • 54. DO YOU WANT © 2011 Double Encore, Inc.
  • 55. JENKINS © 2011 Double Encore, Inc.
  • 56. JENKINS © 2011 Double Encore, Inc.
  • 57. © 2011 Double Encore, Inc.
  • 58. INSTALL & RUN © 2011 Double Encore, Inc.
  • 59. INSTALL & RUN > brew install jenkins © 2011 Double Encore, Inc.
  • 60. INSTALL & RUN > brew install jenkinsjava -jar /usr/local/Cellar/jenkins/1.428/lib/jenkins.war © 2011 Double Encore, Inc.
  • 61. INSTALL & RUN > brew install jenkinsjava -jar /usr/local/Cellar/jenkins/1.428/lib/jenkins.war launchctl load -w ~/Library/LaunchAgents/org.jenkins-ci.plist © 2011 Double Encore, Inc.
  • 62. DEMO © 2011 Double Encore, Inc.
  • 63. VENDING MACHINE © 2011 Double Encore, Inc.
  • 64. VENDING MACHINE © 2011 Double Encore, Inc.
  • 65. THANKS! © 2011 Double Encore, Inc.
  • 66. THANKS! Jay GravesJay@skabber.com @skabber © 2011 Double Encore, Inc.