In this blog, we will describe how teams can configure a private (on-prem or hosted) cloud and instantaneously launch on-demand, isolated build/test instances to execute their iOS CI jobs, while still meeting the tough demands of the speed of overall execution of the CI jobs.
It’s no secret that speed of CI job execution directly impacts developer productivity and you see developer productivity teams making this one of their top priorities. There are multiple variables that impact the speed of execution of the CI jobs – provisioning time for the environment, seeding the environment for the CI job (config mgmt etc), performance in the environment and getting build/test artifacts in and out of the environment.
If you look outside of macOS dependent development, most of the CI process is happening either in private or public clouds. In these setups, (taking the example of AWS) launching an instance on-demand is super easy, completely extensible and fast. Just start one with an AMI and you have an isolated Linux instance available. Containers make it even easier and more replicable. However, the story is quite different for macOS dev environments for CI.
Existing virtualization approach to creating a macOS dev cloud on Mac hardware is based on the same solution available to virtualize Linux and Windows. However, since this technology is not optimized for a macOS cloud use case, it suffers from challenges of scalability and manageability and only supports specific mac hardware.
In the Anka Build solution, our goal was to make sure that these challenges are addressed and that it provides the same level of agility and scalability as one would get from using AWS. So, Anka Build packages a virtualization software that can run on any mac hardware, is built on top of macOS native Hypervisor Framework, exposes an extensible CLI.
Let’s look at the method of provisioning or launching macOS VMs on-demand in Anka Build.
Step 1 – Create your macOS Anka VM (this will be your template) and seed it with all your build/test dependencies using Anka CLI. This will ensure that no time is spent on preparing the dependencies in the environment for when a job runs.
Step 2 – Put this Anka VM (template) in an “Instant Start” State. It’s called suspend state in Anka CLI. This will ensure that when your iOS CI job requests an environment, the macOS Anka VM will be available instantly for execution, without any boot time issues. It will also ensure that you always get the same, consistent instance for repeated execution of the same job.
Demo Video for Instant starting Anka macOS Vm from a suspended state.
Step 3 – Push the suspended Anka VM to Anka registry. If you need different flavors of build/test instances for different types of CI jobs, then, create and push different versions of the same Anka VM template to the registry and use them by referring to a specific tag in your jobs. You can also create additional Anka VM templates(for when you need different macOS version) and push them to the registry and use them for your CI jobs.
Step 4 – Install Anka Build mac application on all your build and test mac hardware (“nodes”) and join them to Anka Build controller.
Step 5 – Integrate your CI system to Anka Build controller through one of our existing plugins(Jenkins) or through REST APIs. Anka Build controller will now launch one or multiple macOS VMs on-demand across your build and test mac hardware, based on your CI job requests and your jobs will execute instantaneously.
Step 6 – Trash the macOS Anka instances or keep them for troubleshooting. Get consistent, isolated instances for the next job execution.
Step 1 and Step 2 address the tough demands of developer productivity teams to provide faster provisioning time of the macOS build/test instances in a macOS cloud for CI and enables them to keep build and test queue moving along with increased speed, efficiency, and determinism.