BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News How Airbnb Improved its CI Pipeline for iOS Using AWS and Terraform

How Airbnb Improved its CI Pipeline for iOS Using AWS and Terraform

This item in japanese

Airbnb has historically managed its own fleet of Macs to run its iOS continuous integration pipeline. Due to AWS adding support for Macs, Airbnb engineers could migrate their iOS CI infrastructure to AWS to increase flexibility, consistency, and efficiency.

Contrary to how Airbnb manages the rest of the platforms it supports, the CI pipeline for iOS did not initially run on AWS. In fact, using Macs enabled leveraging Apple tools to build the iOS app and run its tests, but increased maintenance costs and reduced testing efficiency.

In particular, an engineer had to ensure the entire fleet of Macs was enrolled in Airbnb mobile device management tool and that they ran the latest version of macOS and Xcode. Having a dedicated engineer did not prevent the possibility that some Macs could enter a bad state and be excluded from the pipeline. Updating to the latest Xcode also posed several issues, with the potential effect of further reducing the fleet of available machines for testing and maintenance costs.

The availability of macOS AMIs, explains Airbnb engineer Michael Bachand, allowed Airbnb to move its CI pipeline to AWS, with several distinct benefits. Those include the possibility of using a single AMI used to automatically launch any additional instance required, as well as consolidating the CI infrastructure across all supported platforms.

Airbnb uses HashiCorp Packer to build AMIs. The tool can launch and configure an EC2 instance based on a template defined in the HashiCorp configuration language (HCL). This step can be fully automated and the Packer template can be version-managed using Git.

Another essential component in Airbnb CI solution is Terraform, which is used to deploy the iOS CI infrastructure to AWS similarly to other supported platforms.

All of our AWS infrastructure for iOS CI is specified in Terraform code that we check into source control. Each time we merge a pull request related to iOS CI, Terraform Enterprise will automatically apply our changes to our AWS account.

Scaling is handled through Auto scaling groups using a modified version of buildkite-agent-scaler. Instances are created from a launch template, which specifies all of its characteristics, including the AMI and a "launch" script.

This CI setup provides several advantages, says Bachand. On the one hand, it makes it easy to create a new CI environment for each required CPU architecture and Xcode version. When the CI environment is not used, it can be disabled by changing the Autoscaling group configuration.

Another advantage of this setup is the possibility of rotating instances by terminating and replacing them daily. This reduces the chance that instances drift by clearing their internal SSD, the NVRAM variables, and updating the firmware. If an instance experience goes adrift anyway, it is easy to exclude it from the autoscaler and add a new, clean instance.

Thanks to this approach, writes Bachand, Airbnb has been able to get the benefits of virtualization without the performance penalty of using virtual machines and to unify how they handle their CI infrastructure for every supported platform. Do not miss the original article if you are interested in the full details about their migration.

About the Author

Rate this Article

Adoption
Style

BT