CI / CD

Continuous Integration / Continuous Deployment

Akash Yadav
4 min readJul 4, 2022
Summarized CI/CD pipeline

Overview

Developers / teams store code in central repositories, such as Git for easy tracking, collaboration and maintenance.One can either setup thier own infrastructure or pickup from any of the hosted services (GitHub / GitLab / CircleCi) for fees/subscription.

Apart from acting as code storage repository, it also offers some advanced features that enable achieving complex workflows in order to automate tasks. One such task is to automate the software lifecycle, which includes phases like compilation, testing, packaging, and deployments to servers.

Some key examples include promoting newer versions of codebase to production servers, publishing newer app versions to app stores.

Continuous Integration (CI)

CI refers to the development practice of regularly pushing changes in small increments to a central repository. CI enables developers to make smaller changes and have them integrated into shared repositories. This reduces the complexities of each change and makes collaboration on a large codebase easier.

Changes pushed to repository triggers build and integration flows like compilation, validation and packaging. While CI is most often used to represent the automated process of invoking such lifecycle phases, it also encapsulates a cultural concept of developers merging the artifacts produced in smaller chunks.

Continuous Deployment (CD)

Analogous to CI, CD represents the process of incrementally promoting newer versions of software to different servers, including staging and production.

Because of its impact scope, CD can promote bad code and ultimately degrade customer experience or even downtime to deployed component / service. Continuous deployment practice must include setting up and evaluating right trigger metrics and guardrails to prevent malicious or bad code from getting deployed.

CD also provides an opportunity for implementing time constraints and automated rollbacks. Which can prevent deployments on non-working hours and automatically reverting bad changes reduces the impact from customer perspective.

Why do I need CI/CD?

Software components need integration with various other services , components and each change in codebase poses a risk of breaking those integrations. Manually validating and testing each change can be time consuming and becomes a hurdle in making newer features available to customers.

As modern software infrastructure grew complex, the underlying challenges involved also became more clear. For example, nowadays with cloud servers, it's easier to operate a service on many compute instances. Which are not only difficult but impossible to manage by hand even with a large team.

With microservices' architecture and other similar micro constructs, it becomes a complicated web of interconnected components, with each component existing in multiple versions. Safely updating each component while keeping all associations available gets super difficult. CI/CD makes it possible for implementing flows for a variety of use cases, for e.g. packaging software for different targets like Windows, Unix and Mac with no human effort.

What CI/CD offers?

CI/CD not only solves the presented challenges but also offers unique opportunities, such as deriving insights from workflow execution. Few of the key benefits of adopting CI/CD are as following

  1. Faster Iterations and Delivery: Without manual intervention, it becomes super fast to promote a change to production servers and hence make a new feature/ bug fix available for customers.
  2. Reduced Risk: Cost associated with a software bug is directly proportional to the lifecycle stage it discovered in. Triggering automated tests and validations as soon as a change is promoted, makes it easier to troubleshoot a bad code change and course correct.
  3. Improved developer experience: Smaller changes are easier to merge and avoid overhead of merging a divergent codebase. It also makes it easier to recieve similar changes from other contributors and avoid conflicts promoting better collaboration.
  4. Improved Customer experience: Increased frequency of bug fixes and newer features with incremental enhancements improve customer experience by avoiding frustration of large wait times and delays.
  5. Unique opportunities: CI/CD makes it possible to assert correctness of target codebase by re-running test cases and generating insights from it. CI/CD also helps to implement guardrails that help avoid broken features from being promoted and causing impact. CI/CD can assist users by implementing guard rails like Time Blockers to avoid deployments on holidays, weekends or late nights.
  6. Expandable and Repeatable: CI/CD setup is easily repeatable for multiple repetitions and can easily expand with minimal changes in configuration. For example, we can make an application currently deployed to Google play store to deploy on Apple app store with a similar configuration change.

Popular Platforms

  1. Jenkins
  2. GitHub
  3. Gitlab
  4. Circle CI
  5. AWS Code Deploy

Is CI/CD right for me?

As softwares strive to be more reliable and increased usage across critical functions in our daily lives, even short durations of degradation and downtime can impact revenue and reliability perception of a service. CI/CD offers tools to automate and improve software release workflows.

There might be situations when a CI/CD solution can be a challenge for e.g..

  1. We rarely updated software codebase: While very rare, but still possible for a codebase which is updated on rare occasions.
  2. Not enough test cases, validations in place: If application validations or test cases are not mature or don't cover critical functionalities, a bad code change can get promoted, causing production impact or downtime.
  3. Team is not ready for automated deployments: CI is a cultural thing that team needs to incorporate to make it a success. If the team is not confident about automated deployments, one should gradually introduce automations in the deployment workflows.

Conclusion

CI/CD practices introduce speed and agility into a software development lifecycle. I highly recommended it to implement automated integration and deployment processes to improve customer satisfaction, team experience, and avoid mistakes.

For newer implementations, we can adopt ci/cd on day 0 to structure and design pipeline, but for existing applications, one should gradually make improvements to achieve automated integration and deployments.

Also, implementing right guard rails and monitoring is also one of the key aspect that one shouldn't overlook when implementing ci/cd pipelines.

--

--