the cartoon Scooby Doo. • Jenkins used to be called Hudson until the Oracle corporation trademarked Hudson. So the guys who wrote Hudson, renamed it to Jenkins and kept on developing on it. (There are plenty of butler names left it this one doesn’t work out...)
infinite loop while : do #Do useful stuff here. echo "I am Alfred, and I am here to serve you." FILECOUNT=$(ls -b | wc -l | tr -d ' ') echo "I see $FILECOUNT files." if [ $FILECOUNT -ne "1" ]; then echo "There are too many files." fi #Wait a bit echo "Alfred will rest a while now." sleep 5 done
to code ‘frequently’ with an aim to improve the quality of the software by notifying a human when something does not compile, run, or pass a test. • Frequency: Every time the code changes or on a regular basis (hourly, nightly, weekly)... • Operations: Pull, Compile, Test, Package, Deploy • Notify: web page, reports, email
of our SDK, tools, and reference applications. • I have Jenkins set up on my laptop (but we really should be using a separate machine) • We manually kick off a build for our drop. git pull, xcodebuild, xcrun, appledoc, create a TestFlight package, and zip everything up. • It used to take me about 2 hours to manually build a drop. Now it is just a few minutes because moving to Jenkins forced me to automate everything
could be building our linux binaries on one of our linux servers using Jenkin’s node management system • We could be having Jenkins run automated UI tests using accessibility features of iOS and some cool tech Josh showed us last week • We could be having Jenkins run non-graphical unit tests.
it will create a sort of pseduo-user on your system named jenkins. You’ll want to make that a ‘real’ user if you’re building signed iOS projects due to key-chain / certificate issues sudo dscl . create /Users/jenkins sudo dscl . create /Users/jenkins PrimaryGroupID 1 sudo dscl . create /Users/jenkins UniqueID 300 sudo dscl . create /Users/jenkins UserShell /bin/bash sudo dscl . create /Users/jenkins home /Users/Shared/Jenkins/Home/ sudo dscl . create /Users/jenkins NFSHomeDirectory /Users/Shared/Jenkins/ Home/ sudo dscl . passwd /Users/jenkins
it’s time to tell the LaunchAgent that came with the install package to use this user to run Jenkins. The file you have to change for this is located at /Library/LaunchDaemons/org.jenkins-ci.plist . Just open it in your favorite editor and change the value of UserName to jenkins: <key>UserName</key> <string>jenkins</string> After doing that, the Home folder of jenkins, /Users/Shared/Jenkins/Home needs a new owner. sudo chown -R jenkins /Users/Shared/Jenkins After doing all that, saving the modified launch file and chown’ing the Home, unload and reload the service: sudo launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
you developer key/cert and distrubtion key/cert to files. Go to keys in KeyChain access, find your developer key and expand it. Highlight it and the cert, right click and choose “Export 2 items”. Save to a file and give it a password. Do the same thing for your distribution key. You have to export the key and the certificate together. You should end up with two password protected .p12 files. Copy these files to the Jenkins home folder. Log in as the Jenkins user and set up the keychain: security create-keychain -p jenkins appledev security default-keychain -s appledev Now you import your distribution key and certificate into the new keychain: security import developer_cert_and_key.p12 -k appledev -f pkcs12 -A -P <your_pkcs12_password> security import distribution_cert_and_key.p12 -k appledev -f pkcs12 -A -P <your_pkcs12_password> Before doing any code signing you’ll need to unloack the keychain. This should be done in your Jenkins script: security unlock-keychain -p jenkins /Users/Shared/Jenkins/Home/Library/ Keychains/appledev
provisioning profiles to: / Users/Shared/Jenkins/Home/Library/MobileDevice/ Provisioning • One of your commands has to be to unlock the keychain: security unlock-keychain -p jenkins /Users/Shared/Jenkins/Home/ Library/Keychains/appledev
building and signing iOS apps from the command line • Use command line steps to build and sign your iOS apps • Use a Jenkins-scheme in your project • If you have the means, try to run Jenkins on
pain. Sometimes we have to restart Jenkins because it can’t code-sign. I blame Apple. Could be related to my machine sleeping / resuming? • If you plan to use Jenkins for doing code- signing you’re going to end up doing most of the work in scripts, the plug-in scene is a