1

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

 1 year ago
source link: https://www.infoq.com/news/2023/05/airbnb-ios-ci-aws/?itm_source=infoq&itm_medium=popular_widget&itm_campaign=popular_content_list&itm_content=
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

May 19, 2023 2 min read

AirBnb has historically managed its own fleet of Macs to run its iOS continuous integration pipeline. Thanks to AWS providing 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 platforms it supports, the CI pipeline for iOS did not originally 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 as well as 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 a number of issues, with the potential effect of further reducing the fleet of available machine for testing and maintenance cost.

The availability of macOS AMIs, explains AirBnb engineer Michael Bachand, allowed AirBnb to move its CI pipeline to AWS, with a number of 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 is able to 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 in a way similar 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 a number of 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 changing the Auto scaling 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. In case 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

Sergio De Simone

Sergio De Simone is a software engineer. Sergio has been working as a software engineer for over fifteen years across a range of different projects and companies, including such different work environments as Siemens, HP, and small startups. For the last few years, his focus has been on development for mobile platforms and related technologies. He is currently working for BigML, Inc., where he leads iOS and OS X development.

Show more

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK