Scaling iOS CI with Anka

Shopify has a growing number of software developers working on mobile apps such as Shopify, Shopify POS and Frenzy. As a result, the demand for a scalable and stable build system increased. Our Developer Acceleration team decided to invest in creating a single unified build system for all CI/CD pipelines across Shopify.

Sander Lijbrink
9 min readintermediate
--
View Original

Overview

The article discusses Shopify's approach to scaling its iOS Continuous Integration (CI) system using Anka, a virtualization technology that allows for efficient macOS environment provisioning. It highlights the challenges faced with previous infrastructure and the improvements achieved through the implementation of Anka, leading to enhanced scalability and maintainability of the CI system.

What You'll Learn

1

How to implement a CI system using Anka for macOS virtualization

2

Why using Mac Minis can be more cost-effective than Mac Pros for CI builds

3

How to manage and distribute macOS images efficiently across build nodes

Prerequisites & Requirements

  • Understanding of Continuous Integration and Continuous Delivery (CI/CD) concepts
  • Familiarity with Anka and Buildkite(optional)

Key Questions Answered

What challenges did Shopify face with its previous CI infrastructure?
Shopify's previous CI infrastructure faced issues such as maintenance burdens, a single point of failure due to shared storage, and limitations in scalability. The reliance on VMware ESXi and Mac Pros created difficulties in managing resources and build stability, especially under high workloads.
How does Anka improve the CI process for iOS development?
Anka improves the CI process by providing a Docker-like interface for creating lightweight macOS virtual machines, enabling fast provisioning and superior boot times. This allows Shopify to run builds more efficiently, reducing setup times and eliminating shared storage as a single point of failure.
What are the benefits of using Mac Minis over Mac Pros in Shopify's CI system?
Mac Minis are more cost-effective than Mac Pros, allowing Shopify to run multiple Mac Minis for the price of a single Mac Pro. They provide sufficient performance for CI tasks without the need for a Storage Area Network (SAN), enhancing scalability and reducing costs.
How does Shopify manage the distribution of Anka images across different regions?
Shopify uses a controller node to provision Anka VMs with all necessary dependencies and pushes these images to Anka registries. The images are optimized for disk space and transfer times, allowing for efficient updates and distribution across Mac Minis in different data centers.

Key Statistics & Figures

iOS build jobs per hour
350
This is the number of iOS build jobs run by Shopify's team of about 60 iOS developers.
Time to generate a base macOS image
30 minutes
This is the time required to create a new macOS image using the command 'anka create'.
Time to upgrade Xcode version
about 1 hour
This is the estimated time to upgrade the Xcode version in the Anka environment.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Virtualization
Anka
Used for creating lightweight macOS virtual machines for CI builds.
CI/CD
Buildkite
Serves as the scheduler and front-end for Shopify's CI system.
Virtualization
Vmware Esxi
Previously used for managing CI infrastructure before transitioning to Anka.
Infrastructure
Macstadium
Provides the physical Mac hardware for running CI builds.

Key Actionable Insights

1
Implementing Anka for macOS virtualization can significantly enhance your CI/CD pipeline's efficiency.
By using Anka, teams can provision macOS environments quickly, which is crucial for maintaining high throughput in iOS development. This is particularly beneficial for organizations looking to scale their mobile development efforts.
2
Consider using Mac Minis for CI tasks to optimize costs while maintaining performance.
Switching from Mac Pros to Mac Minis can lead to substantial cost savings, allowing teams to allocate resources more effectively without sacrificing build performance.
3
Utilize layered image management to speed up the distribution of updates across build nodes.
By leveraging Anka's image management capabilities, teams can reduce the time required to push updates, ensuring that all build nodes are running the latest configurations with minimal downtime.

Common Pitfalls

1
Relying on shared storage can create a single point of failure in CI systems.
This can lead to degraded performance and build stability, especially under high workloads. To avoid this, consider using local storage solutions that eliminate shared dependencies.
2
Overloading a single machine with multiple VMs can degrade performance.
When multiple VMs share resources on the same host, it can lead to contention and slow down build processes. Running a single VM per machine can mitigate this issue.

Related Concepts

Continuous Integration (ci)
Continuous Delivery (cd)
Macos Virtualization
Build Automation