Image
Continuous_Integration_blog_banner_image

Understanding the “What, Why and How?” of CI/CD

Sonal Tripathi
April 1, 2021

What is CI/CD, and why it matters:

Be it any business today, the customer expectations are always the same – they want a reliable and efficient product. The times where software releases were annual and followed the waterfall model are far behind. Delivering customer value continuously requires a refined software development lifecycle that saves time, effort, and cost wherever possible. Jade Global tells you how CI and CD can achieve this for you.

Continuous Integration (CI) is the practice where developers detect, locate and fix errors easily and quickly by integrating their code from time to time into a shared repository and running automated tests on it.

Continuous Delivery (CD) ensures that the code is continually in a state ready to be deployed. This reduces sprint time and creates speedy and effective feedback between customers.

Together, CI/CD plays an important role in ensuring that the code addressing customer needs is fully functional and ready to be used anytime needed.

Software Development Before CI/CD technology:

Blog1

The purpose of shorter lifecycles is achieved only by Continuous Integration and Delivery, which was not the way before. Slow development, infrequent releases created bottlenecks as merge conflicts came up very late in the cycle resulting in delayed response to customers.

Adopting CI/CD resolves this issue. CI/CD encourages working more continuously, from deciding on writing code to requirement gathering and obtaining feedback.

The Working of CI/CD:

In a CI approach, developers check their new code at regular intervals to which an automation process is triggered on each commit.

This includes running a build and then triggering automation, providing a gist of the commits made and a dashboard to indicate if the tests passed or failed.

When CI is used, users can quickly create lightweight branches, which will enable building and testing these changes on a staging or development branch before merging it to the master branch. If all these have passed, then the branch can be merged.

Continuous Delivery is an advanced version of Continuous Integration. If the automation build clears the tests, Continuous Delivery will ensure these changes are pushed to the staging environment in a ready state for review and feedback by stakeholders, which can be deployed at any given time.

Blog1

How CI/CD impacts the business?

  1. With CI/CD, the link between the tools that developers want to use, and the business value is easily possible. As the new code is regularly checked in and tested, the business knows that bug fixes, improvements and new functionalities are always working.
  2. Identifying errors earlier in the cycle can prevent time spent on backtracking and knowing where the code broke. Knowing that the new code developed is ready for deployment reduces bottlenecks in the latest release, enabling delivery early and saving cost.
  3. A CI system can also reduce a lot of work for the developer. The developers need not worry about building their changes with different operating systems or other environments.

Benefits of CI/ CD:

  1. Resource Efficient: CI/CD, coupled with containers, empowers users to dynamically scale up or down and on demand, which helps to save on infrastructure costs.
  2. Provides more control and visibility: Using CI/CD integrated into the repository management system enables developers to have more control and visibility over their build pipeline, allowing them to identify issues early.
  3. Faster Release Rate: Failures are detected faster, ensuring fixing issues early, leading to increased release rates.
  4. Time-efficient: A built-in CI/CD solution reduces complexity and allows developers to spend less time troubleshooting when APIs change.

There are many CI/CD tools available in the market for use. Jenkins and Gitlab are undoubtedly two of the most admired choices.

Jenkins vs Gitlab:

  • With Gitlab, users can control and use Git repositories with total control over branches to keep code safe from sudden threats. However, Jenkins does not allow the user complete control over branches.
  • Jenkins allows 3rd party integration to tools like Slack, Github, etc. however, Gitlab allows multiple 3rd party integrations accessible like Kubernetes, Docker, etc.
  • Jenkins does not allow users to analyze performance, whereas Gitlab has provisions for analyzing the performance.

A simple example of CI/CD using GitLab:

Blog3

  • The next step is to create a pipeline for the GitLab-demo project
  • Create a.gitlab-ci.yml file in the root directory of the project. This file will contain the stages of the pipeline.

Blog4

  • Each stage will contain a script for each step in the pipeline. Below is the file content:

Blog5

  • Once we commit the file, there is a runner process that reads this file and creates all the pipeline stages accordingly. The pipeline will look like this:

Blog6

  • Click on any pipeline to view all the stages of the execution.

Blog7

Conclusion

Continuous Integration and Continuous Delivery is an ideal scenario for any organization. Developers push code to a repository that is integrated, tested, deployed, tested again, merged with infrastructure and is ready to be deployed with high confidence. Using CI/CD improves code quality allowing to deliver software updates quickly. And all of this makes releases shorter and efficient.

About the Author

Sonal Atul Tripathi, Software engineer - QA

Sonal is a Software Engineer – QA at Jade Global. She has 6+ years of experience in Software Testing in Agile and expertise in Functional Testing, Automation Testing and ServiceNow.

Add New Comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.