Configuring Jenkins Pipeline for iOS CI to run on Anka Build macOS cloud

In this blog, we will describe steps to run Jenkins iOS CI jobs defined as pipelines on macOS slave VMs running on Anka Build Anka Build macOS cloud. One of our previous blog titled “configuring Jenkins iOS CI macOS cloud” covered the basic steps to configure Jenkins-Anka Build plugin and steps to use it in Jenkins iOS CI jobs defined through web UI. Jenkins pipeline provides an extensible set of tools for modeling simple-to-complex delivery pipelines “as code” via the Pipeline Domain Specific Language (DSL) syntax. When using it in combination with Anka Build macOS cloud, the steps are relatively straightforward.

Step 1 – Install and setup Anka Build Jenkins plugin.

Step 2 – Set Anka Build macOS private cloud IP details in the plugin.

Step 3 – Create Anka macOS VM Slave templates to use for your iOS CI jobs. In this step, you will define a label for each of these slave templates.

ANka Build plugin Slave template

Step 4 – Define your Jenkins pipeline – https://github.com/asafg6/jenkins2-pipeline-example. This example is a simple pipeline definition which executes Build and Test scripts/actions. The pipeline launches Anka macOS VMs (Jenkins slaves) on-demand on Anka Build cloud as per the label definition.

Sample Jenkins Pipeline Job

Using Anka Build Slave template label in Pipeline definition

Step 5 – When this pipeline executes, it launches one or multiple macOS VMs on-demand for job execution. Every build and test job gets a sterilized, consistent environment.

Pipeline jobs executing on Anka Build macOS cloud

If you are using other declarative CI tools or platforms like Gitlab CI or Buildkite, you can use anka command line tool interface for easy integration with agents/runners. In such scenarios, the agent/runners running on macOS hosts will be able to launch on-demand Anka macOS VMs from templates (pulled from Anka Registry) , to fulfill job requests. We will be covering these scenarios in our upcoming blogs.