Set up a macOS VM build infrastructure with Anka Registry
Currently, this feature is behind the Feature Flag
CI_VM_INFRASTRUCTURE. Contact Harness Support to enable the feature.
This topic describes the high-level workflow for setting up a Harness macOS build farm that works with Anka's virtualization platform for macOS. Using this workflow, you can set up a highly scalable build farm with multiple VMs and nodes to run your macOS builds with Harness CI. The workflow is comprised of the following steps:
- Install Anka and create a VM on a Mac node
- Set up port forwarding on the VM
- Set up the Anka controller and registry
- Install the Harness delegate and runner
- Set up the Harness runner to communicate with the Anka controller
- Set up the delegate in the Harness pipeline
- Add other Mac nodes and VM templates to the Anka registry
The following diagram shows how Harness CI and Anka work together. Once you set up the Harness and Anka components, you can easily scale up your build farm with additional templates, build nodes, and VMs.
Install Anka and create a VM on a Mac node
The first step is to set up the Anka software on one of your Mac nodes (such as a Mac Mini) and create a VM. For details, go to Getting Started in the Anka documentation.
When you finish this workflow, you will have a macOS node with a working VM. After you set up the Anka registry, you can then push the node and the VM to the registry.
Set up port forwarding on the VM
This enables connectivity between the Harness runner and the VMs. On the VM host, run the following command for each VM template:
anka modify $VM_NAME add port-forwarding service -g 9079
For details, go to the Anka documentation about Modifying your VM.
Set up the Anka controller and registry
Set up the Anka registry and controller. For details, go to the Anka documentation about Setting up the Controller & Registry.
When you finish this workflow you will have:
- A running instance of the Anka controller and registry.
- A Mac node (such as a Mac Mini) in the Anka cluster. This node has Anka virtualization software installed.
- A VM template in the registry. You can use this to create VMs on other nodes as you add them to the cluster.
Optionally, you can enable token authentication for the controller and registry as described in the Anka documentation about Configuring Token Authentication.
Install the Harness delegate and runner
Set up the Harness delegate and runner.
In addition to macOS, you can run your delegate and runner on Docker, Azure, and Google Cloud Platform build infrastructures.
For information about installing delegates, go to Install a delegate.
Set up the Harness runner to communicate with the Anka controller
On the Harness runner host, update up the
pool.env file as shown in the following Drone Runner config example:
- name: anka-build
# node_id: // create pool from specific node
registry_url: https://anka-controller.myorg.com:8089 #make sure to specify the controller URL
Set up the delegate in the Harness pipeline
In your Harness Project, go to a pipeline that includes a Build stage.
In the Infrastructure tab of the Build Stage, define your infrastructure as follows:
- Type = VMs
- Pool Name = The
namefield in your
- OS = MacOS
Your macOS build infrastructure is now set up. You can now run your Build stages in your build infrastructure.
Add other Mac nodes and VM templates to the Anka registry
Now that you've gone through the entire end-to-end workflow, you can add more nodes and templates as needed. After you join a node to the cluster, it can pull templates from the registry and use them to create nodes.
Before you push each VM to the registry, make sure that you enable port forwarding as described in Set up port forwarding on the VM above.