Advertisement
Advertisement

More Related Content

Advertisement

360iDev OTA Distribution and Build Automation

  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 .ipa file 2. A .plist file © 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 .ipa APPFILE=$(find . -name MyApp.app) mkdir Payload cp -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 l y n © 2011 Double Encore, Inc.
  33. SCRIPT IT ? l y n © 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/sh git remote update local=$(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 jenkins java -jar /usr/local/Cellar/jenkins/1.428/lib/jenkins.war © 2011 Double Encore, Inc.
  61. INSTALL & RUN > brew install jenkins java -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 Graves Jay@skabber.com @skabber © 2011 Double Encore, Inc.

Editor's Notes

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. Xcode comes with the ability to save builds that deliver OTA already.\nThey just hide it under the word “Enterprise”\n
  10. I will show you how all this works now.\n
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. Here you can see GroupA.zip\nIt has a root directory name “Payload”\nInside that is our .app\n
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. Variables will be defined at the top of the script.\nI have the script available online and after the talk for everyone.\n
  47. Once we have the .ipa and the .plist creaged we need to get them uploaded somewhere\nAmazon S3, FTP, SCP, ???\n
  48. Think of all the other things you could do at this point.\n
  49. Think of all the other things you could do at this point.\n
  50. Think of all the other things you could do at this point.\n
  51. Think of all the other things you could do at this point.\n
  52. Think of all the other things you could do at this point.\n
  53. Think of all the other things you could do at this point.\n
  54. Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  55. Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  56. Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  57. Lets quickly recap where we are at.\n\nThis gives us that scriptable “Enterprise” switch we were looking for.\n
  58. 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
  59. 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
  60. 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
  61. 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
  62. 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
  63. Set that up via a cron job to run every min and you have a really simple automated build server.\n
  64. Demo the cron job building when a commit happens.\n
  65. 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
  66. 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
  67. \n
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. \n
  74. Double Encore has built or own internal front end App that lists all the available \napps we can install from Jenkins.\n
  75. \n
  76. \n
Advertisement