Hi! If you’re here for Adam’s Connect.Tech talk on continuous cross platform mobile development using Jenkins, then you are in the right place!
Slides
Installation Guide
Prerequisites:
Note: If you prefer to install and run everything as a Jenkins user, check out this guide for instructions. Please see the slidedeck for additional notes on isues with Node.js and the jenkins user.
My short and sweet guide is as follows:
Logging in to the Mac’s administrator account, install tools needed to do your x-platform builds:
Xcode (be sure to open it after installing to accept any T&C
Android SDKs – in a place that will be reachable by the jenkins user
Java JDK 1.7 or 1.8, depending on your needs. Jenkins supports both now with version 2. (verify by running terminal command java -version
Install Jenkins
Mac OS X installer: (2.x LTS)
https://jenkins.io/content/thank-you-downloading-os-x-installer/#stable
Verify with localhost:8080 (will launch automatically)
Cross Platform-Specific I have come across
- Xamarin
- Appcelerator Titanium
- NativeScript?? Help me out here
- ReactNative?
Security
Lots of (good) changes to Jenkins default security with version 2. You should be walked through setting up a user account upon first launch. Below are my notes for additional security steps:
Enable Security:
- Manage Jenkins > Configure Global Security
- Check Enable security
- Security realm: Jenkins’ own security database
- Click Save
Add Users
Now you see Manage Users under Manage Jenkins
- Manage Users > Create User
- Add an admin account
- Add a ‘user’ account
Now enable security to just permit access with the accounts
- Manage Jenkins > Configure Global Security
- Uncheck allow users to sign up
- Authorization: Project-based Matrix Authorization Strategy
- Add ‘admin’ and check ‘Administrator’
- Add ‘user’ and check ‘Read’
- Click Save and now log in with admin account
Finally, enable security on the job so our user can build it
- Open the test project, select Configure
- Check Enable project-based security
- Add the ‘user’ account, and at minimum check
- Build
- Cancel
- Read
- Add the ‘user’ account, and at minimum check
- Now log in with the user account, you should see the job on the main page
Running builds
There are a multitude of ways to run or ‘trigger’ a build. If you can think of it, it’s probably possibly with Jenkins. Couple of options I’ve found to be useful with our teams:
Build Via URL
JENKINS_URL:8080/job/JOB_NAME/build
And with a parameterized build
JENKINS_URL:8080/job/JOB_NAME/buildWithParameters?param1=hello
More info on paramaterized builds:
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
Useful Plugins
Other Cool Stuff
- fastlane.tools Extend your build workflow to include updating certificates, provisioning profiles, and a whole host of other steps for getting your app submitted to the store
- HockeyApp (for build distribution)
- Pipelines
Jenkins Alternatives