Orka Integrations: Mac and iOS CI with the Orka-Jenkins Plugin
Jenkins is still the single most popular open-source, CI/CD tool available. It allows teams to automate all kinds of things, including macOS and iOS CI workflows. In light of this, MacStadium has created a Jenkins plugin for our flagship product, Orka (Orchestration with Kubernetes on Apple) that offers genuine Apple hardware in the cloud. Orka is a unique, enterprise-ready, Mac virtualization platform that utilizes Kubernetes and Docker under the hood, and exposes certain features of these tools to end-users.
The Orka-Jenkins plugin allows users to provision both static and ephemeral macOS VM build agents in an Orka environment. Static systems will work best for teams that know how many agents they'll need running in their Orka environment in advance, are ok with running jobs on the same agent over and over again, and do not need an on-demand agent provisioning. Conversely, ephemeral systems will best suit teams that want on-demand agent provisioning, and who prefer to run new jobs on a newly created agent.
Installing the Orka-Jenkins Plugin
The simplest way to install a publicly available plugin for continuous integration, such as the Orka plugin, is to navigate to the web UI of a running Jenkins instance. From there, you can navigate to the Manage Jenkins/Manage Plugins view, click the Available tab, and search for "Orka." Once found, you can select it and click "Install Without Restart" to install it.
Connecting Jenkins to Your Mac Cloud for Static CI Builds
To connect your Jenkins server to your Mac cloud, you'll need to navigate to Manage Jenkins/Manage Nodes and Clouds. Click on the New Node tab, provide a name for the node, select Agent running under Orka by MacStadium, and click "Save."
You’ll be redirected to the following setup view:
Once there, you’ll first need to configure your Jenkins instance to talk to Orka. To do so, simply enter your Orka credentials and the public endpoint for your Orka environment. Note that the Orka endpoint accepts HTTP by default, as the traffic is encrypted by a VPN tunnel. HTTPS can be enabled if requested.
Then, you’ll need to select the node in your macOS cloud you’d like to put the agent on – in the above, it’s “macpro-5”. Your node options will auto-populate once you’ve entered a working Orka endpoint and credentials above.
Finally, you will have the choice of using an existing macOS VM or clicking the “Create a new VM config” checkbox to expose the dropdown shown above. Note that all Orka VMs associated with the Orka credentials provided – running or not – will be available in the VM dropdown.
Regardless of what you choose, the base image of the VM needs to have Java 8 installed.
To build your own Jenkins Agent image on a specific macOS version, you can begin by spinning up an Orka VM based on the OS image you need. SSH into the running VM and then install Homebrew, and then Java 8 by running:
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
And finally, save the VM’s current state as an image by running:
orka image save -v <VM_ID> -b <NEW_IMAGE_NAME> -y
Your new image will be available in the base image dropdown shown above.
Finally click “Save” at the bottom of the page, once you’ve entered all of the above.
If all goes well, you should be redirected to the Jenkins/Nodes page, where you’ll see your new build agent. It may take a few moments for the VM to spin up, and then for general installation. You can track its progress by viewing the logs, like so:
Jenkins still reigns supreme in the world of continuous integration, and MacStadium has created a powerful plugin to make it simple to connect your Jenkins master to your Orka build environment securely, as communication requires a VPN connection. Above, we covered the topic of connecting Jenkins to Orka for static builds. To learn about setting Jenkins up for ephemeral builds, check out the Orka-Jenkins plugin’s docs.