Continuous Integration, Delivery and Deployment (CI/CD) in macOS using Jenkins and Fastlane for iOS and Android — Part 1

Part 1: All about CI/CD, top benefits and choosing appropriate CI/CD

Mohammad Mahmudul Hasan
8 min readAug 3, 2021
CI/CD Process

We will divide this tutorial in 3 parts:

What is CI/CD?

CI/CD is a tool that helps to automate the tedious tasks, from building the app to deploying it into production, which makes every developer’s life a lot easier. There are different kinds of CI/CD solutions available for app, web, and even for ML/AI.

The acronym CI stands for Continuous Integration and CD can either mean Continuous Delivery or Continuous Deployment.

CI/CD Graphical Representation

Continuous Integration (CI)

Continuous integration (CI) is the software engineering practice of frequently integrating isolated changes to a larger code base and testing them immediately.

The goal of Continuous Integration is to verify the correctness of those changes and to detect integration errors as quickly as possible. For this it is quite common to run automated tests after every integration.

The process of Continuous Integration (for app) mainly comprises of the following steps:

  1. Running various tests (Unit Tests, Integration Tests, etc.)
  2. Building the app (from code)
  3. Creating artifacts (.apk, .ipa, etc.) which can be later used in the distribution.

The Continuous Integration for ML/AI is a bit different from the traditional CI steps.

  • In building stage of ML/AI, data is also sent along with the code.
  • Also there is an additional stage after building, that is the training stage for the ML model, which takes the most compute time in the entire process.
  • A trained ML model is generated as the artifact in this case.

Continuous Delivery (CD)

Continuous Delivery is used to release a newly built version of your app to the customers as quickly as possible. Every time a new version is built successfully, it can merged with the git-based repository hosting platform (GitHub, GitLab, etc.) and you can easily deploy the new version of your application at any point of time with the click of a button.

The goal of Continuous Delivery is to ensure the code of a software is always in a deployable state, no matter if it includes new features or just bug fixes.

Continuous Deployment (CD)

Continuous Deployment goes one step further than the continuous delivery. It also prevents the last level of human intervention in the pipeline by automating the deployment of your app build. Only a failed build or test will prevent a new change to be deployed into production. This is mainly used to accelerate the app production, to get faster feedbacks from the customers. Also, teams following this process of deployment, doesn’t need to have a Release Day anymore!

Top Benefits of CI/CD

  • Smaller code changes are simpler (more atomic) and have fewer unintended consequences.
  • Fault isolation is simpler and quicker.
  • It improves overall code quality. Since code is released in small batches, it is possible to test it thoroughly (e.g. using unit tests) detecting and fixing the most serious bugs before software is deployed to production.
  • Mean time to resolution (MTTR) is shorter because of the smaller code changes and quicker fault isolation.
  • Testability improves due to smaller, specific changes. These smaller changes allow more accurate positive and negative tests.
  • Elapsed time to detect and correct production escapes is shorter with a faster rate of release.
  • The backlog of non-critical defects is lower because defects are often fixed before other feature pressures arise.
  • The product improves rapidly through fast feature introduction and fast turn-around on feature changes.
  • Upgrades introduce smaller units of change and are less disruptive.
  • CI/CD reduce costs and labour.
  • CI-CD product feature velocity is high. The high velocity improves the time spent investigating and patching defects.
  • Feature toggles and blue-green deploys enable seamless, targeted introduction of new production features.
  • You can introduce critical changes during non-critical (regional) hours. This non-critical hour change introduction limits the potential impact of a deployment problem.
  • Release cycles are shorter with targeted releases and this blocks fewer features that aren’t ready for release.
  • Improved customer satisfaction by ensuring Fast and frequent releases, new features shipped regularly, bugs fixed promptly and immediate reaction to feedback.

Choosing Appropriate CI/CD System

The CI/CD platform market has grown over the years as DevOps become more mainstream, and now encompasses a huge variety of tools, each with their own flavor. While it’s great to have choices, it proved to be a really tough decision to choose the right tool. But generally, the options fall into one of two categories:

  1. Managed CI/CD services accessed through a provider.
  2. Self-hosted services that you can set up and manage yourself.

Some of the pros and cons of these two kinds of CI/CD solution are listed below.

Self-hosted CI/CD

Self-hosted CI/CD solutions basically run on the local machine of the user with the software packages installed on that machine. Some examples of self-hosted CI/CD tools are Jenkins, TeamCity, etc.

Pros

  • One of the biggest benefits of a self-hosted solution is extensibility. Some self-hosted services can be customized with plugins to enable functionality that is not included “out of the box”.
  • Managing security of the entire CI/CD system is your own responsibility but you do not have to rely on the security of the external providers. Eliminating the need to go outside of your private networks helps to minimize security threats.
  • Degree of flexibility and control over the security processes and tooling that wouldn’t be possible otherwise.
  • Self-hosted CI/CD systems are usually the cheaper option.

Cons

  • You have to maintain your own hardware systems and keep the softwares updated for preventing build failures in the future.
  • Initially, there can be a very time intensive setup process for linking your projects with VCS, issue tracking and notification systems.
  • Have to manage all the authentication needed for the team members for accessing the projects.

Cloud-based CI/CD

Cloud-based CI/CD (also known as SaaS tools) uses hardware systems and the softwares stored on a cloud server. Some examples of cloud-based CI/CD tools are Travis CI, CircleCI, Codemagic, etc.

Pros

  • The biggest benefit of using cloud-based CI/CD solution is that you do not have to maintain any hardware or software infrastructure. All the software updates are also handled by the cloud based CI/CD provider.
  • Initial setup is fast and easy. Also most of the SaaS CI/CD solutions have a good integration with git based VCS like GitHub, GitLab, Bitbucket, etc.

Cons

  • There might be some extra cost that you have to bear, as per the service you will be using. And the price of a Cloud based CI/CD service may go up as your team gets larger.
  • All Cloud based CI/CD solutions do not have support for all platforms, tools, and environments.
  • Externalizing control over the infrastructure may not be a good idea.
  • Managed CI/CD services almost invariably have a higher cost than self-managed when looking at the basic numbers. Frequently, managed providers start off fairly cheap, but can become more expensive quickly as your organization scales out.

So which CD/CI tool is the best?

It’s hard to decide because there are so many options out there — a Google search for ‘CI/CD’ gives half a billion results!

I’ve done the research and compiled a list of the top 5 Continuous Integration (CI) and Continuous Delivery (CD) tools (in no particular order):

  • Jenkins
  • TeamCity
  • GitLab CI/CD
  • CircleCI
  • Travis CI
  • Drone CI

Here’s a quick comparison of the most important features in each CI tool:

Jenkins is the oldest player in the industry and commands a market share of 71%. With over 1 million users, the community support for this tool is great. What’s even better is that there are 1400+ plugins available today that can serve almost every Continuous Integration (CI)/ Continuous Delivery (CD) need. And if you can’t find a plugin that suits you, you can just create your own and share it with the community.

Jenkins is best suited if:

  • your code is hosted in-house;
  • you want to have complete control over your CI/CD environment;
  • you require an on-premise server;
  • you need highly customized workflows;
  • you can appoint a dedicated person/team to manage and maintain Jenkins;
  • you need an economical solution.

TeamCity is considered the best alternative to Jenkins. It is secure out of the box and offers extremely stable plugins. It’s also got handy integrations with xUnit and other code coverage tools. Like Jenkins, this tool is often used for Java and .NET projects.

TeamCity is considered the best alternative to Jenkins. It is secure out of the box and offers extremely stable plugins. It’s also got handy integrations with xUnit and other code coverage tools. Like Jenkins, this tool is often used for Java and .NET projects.

TeamCity is the tool for you if:

  • you need a working solution without the hassle of maintenance;
  • you can’t appoint a dedicated person/team to manage the Continuous Integration (CI)/ Continuous Delivery (CD) tool;
  • you require speedy customer support;
  • your projects are built on .NET;
  • you have multiple projects with similar configs, each of which progress differently;

GitLab CI/CD is an inbuilt tool that every GitLab user can avail. It allows you to host several GitLab runners on servers and allocate labels to them. This gives you a farm of build servers where builds can be allocated to any server as required. This enables massive scaling opportunities, which tools like Jenkins do not provide.

GitLab CI/CD is your best bet if:

  • your code is hosted in GitLab;
  • you want to outsource your DevOps lifecycle;
  • you don’t want the hassle of setting up and configuring an entirely new tool;
  • you would benefit from a steady rate of feature release;
  • you need an integrated Docker registry;
  • you don’t need plugins.

CircleCI boasts of powerful caching capabilities and highly customizable workflows. This tool is easy to set up and run. It can even be configured to send results directly to a Slack channel.

CircleCI should be your choice of CI/CD tool if:

  • you need inbuilt support for parallelism;
  • your code is hosted on GitHub or Bitbucket;
  • you work on Linux or MacOS;
  • your team consists of multiple developers using the Continuous Integration (CI)/ Continuous Delivery (CD) pipeline;
  • you prioritize speed over all else;
  • you need highly customizable pipelines and workflows.

Travis CI is quick and simple to set up. It integrates seamlessly with GitHub. This tool is different from CircleCI in that it allows you to test on a Mac and Linux OS at the same time.

Travis CI is the perfect fit for you if:

  • your code is hosted on GitHub;
  • you need to support a variety of languages;
  • you don’t use Windows;
  • you need a flexible solution;
  • you need pre-installed database servers;
  • you don’t require many third-party integrations.

Drone is a container-native tool written in Go. The tool is easy to set up and upgrade. It has an Autoscaler feature that lets you automatically scale up or down as required. Drone CI also supports ARM processor architecture.

Drone is your best choice if:

  • you require native Docker support;
  • you need a cloud-based tool;
  • you need a tool that is easy to upgrade;
  • you require direct connections to GitHub, GitLab, Bitbucket and cloud providers like AWS and GCP.

Where to go next

This has been a quick overview of CI/CD. Hope it will help you to choose your CI/CD system. Next we will learn CI/CD Environment Setup, Install and Configure Jenkins in macOS. Please continue to read next Part of this tutorial.

--

--

Mohammad Mahmudul Hasan

A learner, constantly striving to learn new technologies and look the ways to be better in this rapidly changing industry.