What Is CI/CD, and Why Do We Need It? Guide for DevOps Engineers.

Andrey Byhalenko
DevOps Manuals and Technical Notes
5 min readOct 30, 2023

CI CD stands for Continuous Integration and Continuous Delivery/Continuous Deployment.

In this tutorial, I will explain what that means and why we need it in today’s tech world.

Let’s start with the definitions:

  • Continuous Integration (CI): Continuous Integration is a development practice where developers integrate code into a shared repository several times a day. Each integration is verified by an automated build, ensuring early detection of integration errors.
  • Continuous Delivery (CD): Continuous Delivery ensures that code changes are automatically built, tested, and prepared for a release to production.
    Release to production done by manual intervention.
  • Continuous Deployment(CD): While Continuous Delivery ensures code is always in a deployable state, Continuous Deployment means every change is automatically deployed to production without human intervention.

While Continuous Deployment automates the release process by automatically deploying changes to production after tests are passed, Continuous Delivery concentrates on making sure software is always release-ready with manual approval.

Imagine you want to create a gift basket and deliver it to your friends during the upcoming holidays.

So the gift basket comes in pieces; maybe you added wine, chocolate, cheese, some toys for the kids, etc.
Once your basket is ready, you need to verify that it includes everything you planned, wrap it in wrapping paper, and deliver.

You either deliver by yourself or pay a delivery company.

If we translate this into DevOps, the basket creation and wrapping process is called Continuous Integration. You are taking the code, packaging it, and giving it to Continuous Delivery/Deployment process.

If you deliver the basket by yourself, it’s Continuous Delivery.
Delivered by a delivery company, it’s Continuous Deployment.

Importance and Benefits of CI/CD:

  • Faster Release Rate: In the traditional software development model, each project phase was completed before moving on to the next, culminating in a single, major release. This approach was known as the waterfall process. It can take a few days, weeks, or even months to finish this. Agile approaches and CI/CD techniques have revolutionized this approach by making rapid and frequent releases the new norm.

How CI/CD Promotes a Faster Release Rate:

Automated Testing: With CI, every code change is automatically tested.

Parallel Workstreams: Multiple developers or teams can work simultaneously on different features or patches.

Instant Feedback: Developers receive immediate feedback on their code.

Automated Deployments: CD tools can automatically deploy code to staging or production environments.

  • Improved Code Quality: Developers receive immediate feedback on their code. If there’s an error, it’s caught early, and developers can address it quickly rather than waiting for a testing phase much later in the development cycle.
    There is software that checks the code for vulnerabilities, bugs, and code smells.
  • Reduced Manual Errors: By automating the integration and delivery process, there’s a reduced chance of human error.
  • Enhanced Collaboration: CI/CD encourages collaboration between development, testing, and operations teams.
    That means that the teams don’t blame each other but work as a team and take responsibility.
  • Rapid Feedback: Quick feedback loops ensure developers know the impact of their changes immediately.

Key Components of a CI/CD Pipeline:

  • Source Code Repository: Platforms like Git, where code changes are stored.
  • Build Tools: Software like Jenkins, Travis CI, or Octopus Deploy that automates the build and integration process.
  • Automated Tests: Unit, integration, and system tests that ensure code reliability and quality.
  • Deployment Tools: Automated tools like Kubernetes, Docker, and Ansible handle the deployment phase.
  • Monitoring and Feedback: Tools like Splunk, Grafana, or Prometheus that offer real-time insights into application performance.

Challenges and Considerations:

Like everything in this world, CI/CD has it’s own challenges.

  • Maintaining a Robust Pipeline: A pipeline is only as good as its maintenance. Regular updates and checks are vital.
  • Infrastructure Cost: Automation requires robust infrastructure, which can be costly.
  • Skill Gap: Not all teams have the necessary skills to set up and maintain CI/CD. Training and skill development are crucial.
  • Overhead: Setting up CI/CD can add initial overhead. It’s essential to see it as a long-term investment.

Here is a real-life example of the CI/CD process we had at one of the companies I worked for:

Continuous Integration:

  • A developer opens a pull request on GitHub by merging the changes to the Development branch. It triggers the GitHub Action that tests the code using Sonar Cloud, then another GitHub Action builds the Docker image and tests the image with Snyk for vulnerabilities (the Dockerfile is in the GitHub repo).
    Developers receive notification in case the Sonar Cloud test fails.
  • After the Pull Request has been approved by the team leader, another GitHub action will start.
    This action does another Sonar Cloud code test, builds the Docker image, tags it, tests the image with Snyk, and pushes the image to AWS ECR.

Continuous Delivery:

  • There is a runbook that runs on the Octopus Deploy (automation server) that checks the AWS ECR for a new image. Once the new image is recognized, Octopus Deploy gives an order to Harbor (the artifact registry) to download the image from ECR.
  • Once a new image is on Harbor, Octopus Deploy gives an order to the application server to download the new image and restart the deployment.
  • This is how the image was delivered to the Development environment.
    In order to deliver the image to Staging or Production, manual intervention is needed.
    By manual intervention, I mean a single button press. Just an approval.
  • Grafana and Prometheus were used to collect and visualize data from the servers.

Essentially, CI/CD is not just a technology approach but also a business enabler.

Since software is the foundation for most products and services offered today, it is not only desirable but also essential to be able to develop, enhance, and distribute software rapidly.

Since CI/CD is the foundation of this ability, modern software-driven enterprises depend on it to succeed.

If you liked my articles, join my newsletter, and you will receive weekly DevOps tutorials, articles, and tips every Saturday.

As a bonus, you will receive a free step-by-step DevOps CI/CD project, which you can use in your portfolio.

Subscribe here: https://junior-devops-hub.ck.page

--

--

Andrey Byhalenko
DevOps Manuals and Technical Notes

I'm a DevOps Engineer, Photography Enthusiast, and Traveler. I write articles aimed at junior DevOps engineers and those aspiring to become DevOps engineers.