DevOps: Introduction to the CI/CD pipeline

DevOps: Introduction to the CI/CD pipeline

Shipping quality code in efficient timelines is expected from developers. In this article, we explore the CI/CD pipeline- a buzzing DevOps practice.

What is Continuous Integration and Continuous Deployment?

Continuous Integration and Continuous Deployment (CI/CD) is a software development practice that leverages automation as the foundation of the development pipeline.

In the Agile SDLC, developers, and operations teams would manually push commits from building to testing- detecting errors and applying feedback before the product is pushed to deployment and production.

This methodology initiated an iterative development culture, however, it is still manual and requires dedicated teams to review code and test for functionality before deployment.

As the world advances and business demands are ever-increasing, developers are left with shorter timelines to ship features that will enable businesses to drive growth.

Hence, by leveraging automation-driven pipelines like the CI/CD, development can advance with greater speed and less error.

Typical Workflow of the CI/CD Pipeline

As the illustration depicts, progress in the development pipeline is determined by success in the CI stage and then the CD stage.

What happens at the Continuous Integration stage?

As developers commit code to a central repository, an automatic sequence is triggered to build and perform tests such as Unit Testing, Code Quality tests, Integration Tests, etc. to ensure that the commit is fit to merge into the main branch.

If the code fails any of the tests at this stage, then feedback is given to developers to make changes.

Performing smaller tests for each commit may seem intense at first, but it prevents lag as developers spot and fix smaller errors early on in the cycle.

What happens at the Continuous Deployment stage?

A Continuous Deployment sequence is triggered after quality-assured commits have been merged into the branch.

The commits are reviewed, staged, and taken into production.

Business Impact of the CI/CD

As businesses become more Agile in their practices, leveraging the CI/CD pipeline is an asset that enables speed, metric-driven development, and bug-free product updates which impact a healthy user experience.

The iterative process is beneficial to businesses at all stages.

Be it early stage, when the business is experimenting with product features to attain product-market fit.

Mid-tier stage, when onboarding new customers and partners who desire additional features.

Enterprise stage, when penetrating new market segments and discovering new product use cases.

Advantages of CI/CD

  1. Speed: CI/CD reduces the manual process of developers manually committing code, and then overseeing the rest of the processes as the code is deployed into production. With automation sequences in place, the pipeline functions independently, alerting dedicated team members when the code is ready to be pushed into the next stage in the pipeline.

  2. Quality deployment: There are so many potential mishaps that can derail development from inception to production. In the absence of automation, developer teams have to be responsible for committing, running tests, rectifying errors, merging quality commits to the main branch, staging, and delivering to the building environment. It’s a lot of manual activities going on that get in the way of productivity. With the use of automated deployment, developers can focus their strengths on doing what they do best- writing quality code while the CI/CD pipeline takes care of the rest.

  3. Easier error-detection: The Build-Test sequence which gets activated for each commit into the repository makes for quality control in code. Using a school scenario, It’s a lot easier for 1 teacher to supervise a class of 10 students in an exam than a class of 100. With unit tests, errors can be detected in smaller amounts and rectification measures can begin swiftly.

  4. Feature-flag mechanism: Deploying new features doesn’t equal increased product quality or user experience, sometimes there are additional errors that may occur from the server-side or internal parsing issues which may affect feature performance. Either way, these features should not be allowed to negatively affect your users and can be turned off with Feature Flags.

Feature flags are a software engineering technique for toggling feature functionality on and off.

The code sample below denotes what a feature flag looks like.

if (features['new.feature']) {
    RenderNewFeature()
} else {
    RenderOldFeature()
}

At a basic level, they are if-else statements that toggle on and off specific product features.

Drawbacks of CI/CD

  1. Tooling Consensus: During the planning phase, the developers and operations team have to agree on what tools would be used throughout the pipeline process.

    This is important as some tools are language and ecosystem specific while others are less stringent and can be used with any language.

    Looking at the team strengths, the business goals in place, and price points should be useful parameters for helping you make a choice.

  2. Learning Curves: Your developers would likely not be familiar with all the tools you eventually decide to leverage for your CI/CD. However, the learning curves of these tools are important in helping your team stay efficient. Learning new languages and frameworks is no small feat for developers even with many years of experience, so choosing tools that would require a less-challenging learning curve for your team is important.

Further Reading

DevOps: Using Feature Flags for Efficient Product Deployment