MacOS EC2 Instance integrated as Jenkins node for iOS build and test

  • They are currently only available in 5 regions — US East (N. Virginia), US East (Ohio), US West (Oregon), EU (Ireland), and Asia-Pacific (Singapore) AWS Regions
  • They run on dedicated hosts — this makes the starting and shutting down of the instance take longer and it also requires additional steps to start/terminate
  • Billing is per second with a 24-hour minimum allocation period — this means that even if you shut down the instance 5 minutes after starting it, you still pay for it until the 24 hour mark, after the 24 hours are up, billing switches to the regular per second method
  • Jenkins is running on an EKS Cluster within the Sydney region
  • The macOS instance is provisioned in the North Virginia region (macOS instance is available only in certain regions)
  • The 2 VPCs ( Jenkins VPC , macOS VPC) are connected through cross -region VPC peering
  • The macOS instance is setup to build iOS and macOS projects only
  • The instance is added as a build agent to the existing Jenkins running on EKS

Implementation

  1. Setup the VPC : Setup a VPC in the North Virginia region for this example, with a cross region VPC peering to integrate with the existing Jenkins VPC
  2. Launch the instance : Create a dedicated host and launch the instance utilising it
  3. Connect and prepare it to build and test iOS apps: Connect to the instance using ssh and install all the necessary binaries on the instance to build and test the iOS app
  4. Setup the instance to run as a Jenkins agent

1. Setup the VPC

2. Launch and prepare the instance

  • We need a static IP to ensure we do not have to go back to the Jenkins configuration to change the host reference in case the instance gets terminated
  • Keep the disk space 100gb+ as we ran into memory issues while doing the xocde installation on the instance
  • Install java on the instance to attach it as a Jenkins agent
  • Stopping the instance takes a minimum of 15 minutes , be mindful of this while setting up any automation on the instance start/stop

3. Connect and prepare it to build and test iOS apps

  • In order to setup the vnc connection, refer to the aws documentation
  • The macOS AMIs includes the Command Line Tools for Xcode, Homebrew etc, so install whatever else you need for the build, for example xcode, yarn, apple developer certificates etc and then test a local build on the instance
  • Once the instance is ready, bake a golden AMI out of it, that you can use to spin up the instance if you need to do so again

4. Setup the instance as a Jenkins agent

  • Install the “SSH build agent” plugin for Jenkins
  • Create an SSH key to be used for the connection (Since I have an EKS setup, I created a secret and accessed it through the Kubernates credentials plugin)
  • Login to Jenkins as an admin and navigate to “manage nodes and cloud”
  • Configure the node using these settings:
Node settings
Node log

Conclusion and Next Steps

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

PHP VS JS(synchronous and asynchronous)

The Intersection of BIM and Smart Buildings

Designing an API

Authenticating BigchainDB transactions

TRYHACKME — Windows x64 Assembly

Persisting fast in database

Google codejam 2020 solution to vestigium problem

Google codejam 2020 solution to vestigium problem

Torment CTF walkthrough (IRC server exploitation and misusing apache server’s intended…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
prerna priyadarshini

prerna priyadarshini

More from Medium

Easy approach for implementing CI/CD using Jenkins-Part 2

Security for Bitbucket per-repository configuration will be loaded from the default branch

NTLM based User Authentication and SSO in Web Application

Docker — Overview