CI/CD Pipeline: A Gentle Introduction: (Continuous Integration and Continuous Delivery explained)

  • By
  • February 3, 2021
  • Software Testing

It used to be that software development was simply about, completely, software development. As software continues to eat the world, many similar aspects of the development process have become ripe for code to take over. Infrastructure topics such as integration and deployment are best examples. This explains the rise of DevOps. And within DevOps, the CI/CD pipeline is now streaming among software IT companies.
If you are in IT world, understanding the CI/CD pipeline is critical to keeping your organization on par with other software companies. That’s why, in this Blog, I am going to jump into what you need to know about the concepts of CI/CD,

Let’s get into it!

Continuous integration (CI) & continuous delivery (CD) express a lifestyle that contains set of operating, and collection of practices that enable software development teams to deliver code changes more constantly and reliably. This implementation is also called as the “CI/CD” pipeline.

CI/CD is one of the best implementations for devops teams to practice. It is best practice for an agile methodology because it enables software development teams to focus on meeting business requirements, code quality, and security because deployment steps are automated.

Continuous integration (CI) and continuous delivery (CD) wants continuous testing (CT) because the purpose is to deliver quality software and code to users. Continuous testing is repeatedly required for implemented as a set of automated regression testing, performance testing and other tests that are executed in the CI/CD pipeline.

 

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

 

Continuous Integration (CI)

 

The term continuous integration (CI) came from the people working on the thought process. I will cite their official definition first. According to them,

    “Continuous Integration is a development operation that requires developers to merge code into a shared repository several times a day. Each report is supported by an automated build, allowing teams to detect problems early.”

At every time you need to run code integration multiple times a day, every day, and you need to run the automated verification of the integration. What’s the motivation for this?  So, in the development process, the earlier we finish errors, the better. And one source of oftenly occurring errors is the code integration step.

When we have a team of developers, each of them having a responsible for a separate feature, you need to integrate the different features before you’re ready for a release. By integrating so frequently, your team can surface errors earlier. And when those are capture, the amount of backtracking needed to find the cause is also much reduced. Therefore, team can sort out the integration errors much faster.

“(CI) Continuous Integration does not clear all bugs, but it does make them substantially easier to find and remove bugs.”

 

 

The main principles of CI are that you:

  1. Check in code in frequently.
  2. Automate the build and test portion.
  3. Always test the code locally before checking it in.
  4. Never merge any failed branches to the main branch.
  5. Return its status back to successful if you’re the developer who causes the failed build or test.
  6. Make it your top priority to do so once the fail happens.

 

Continuous Deployment (CD)

Jez Humble and David Farley of Thought Works wrote the foundational text on continuous deployment. The official definition stated as

“(CD) Continuous Deployment is closely related to CI and refers to the release into production of software that passes the automated tests.”

So why we need to care about CD as part of your development process?  When there is a time of releases, there will be deployment steps. These deployment steps lean to repeat for each release. Rather than performing the deployment process manually for each release, why not have the deployment steps be executed automatically? Definitely this code has been built and tested successfully by the CI server too.

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

What is a CI/CD pipeline?

A CI/CD pipeline automates the software delivery process. The pipeline builds code, runs tests (CI), and safely establish a new version of the application (CD).

Automated pipelines detach manual errors, gives standardized feedback to the developers, and enable fast product iterations.

 

  • What do CI and CD mean?

Continuous Integration, i.e (CI) is a software development practice in which all developers merge code changes in a central repository multiple times a day. Continuous Delivery, i.e (CD)which on top of Continuous Integration adds the practice of automating the entire software release process.

With Continuous Integration, each change in code triggers an automated build test sequence of test cases for the specific project, providing feedback to the developer who made the change. The entire CI feedback loop should run in a very few minutes.

Continuous Delivery (CD) includes infrastructure provisioning and deployment, which may be manual and made up of multiple stages. Important is that all these processes are fully automated, with each run fully logged and visible to the complete team.

  • Elements of a CI/CD pipeline

A CI/CD pipeline may sound like overhead, but it is not. It is necessarily a runnable specification of the steps that any developer needs to perform to deliver a new version of a software. In the absence of an automated pipeline, engineers would still need to perform these steps manually, and hence the result is less productively.

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

Most software releases go through a couple of stages:

 

 

Failure in each stage typically activates a notification—via email, Slack, etc.—to let the responsible developers know about the cause. Otherwise, the whole team updates a notification after each successful deployment to production.

  • Source stage

All most cases, a pipeline run is activated by a source code repository. A change in code triggers a notification to the CI/CD tool, which runs the corresponding pipeline. Other common set off include automatically scheduled or user-initiated workflows, as well as results of other pipelines.

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

 

  • Build stage

We merge the source code and its dependencies to build a runnable instance of our product that we can possibly ship to our end users. Programs written in languages such as C ,C++, Java or Go need to be compiled, whereas Ruby, Python and JavaScript programs work without this step.

Regardless of the language, cloud-native software is typically deployed with Docker, in which case this stage of the CI/CD pipeline builds the Docker containers.

Failure to pass the build stage is an index of a fundamental problem in our project’s configuration, and it is best way to address it immediately.

  • Test stage

In test stage phase, we run automated tests to validate our code correctness and observe the behavior of our product. The these stage acts as a safety net that prevents easily reproducible bugs from reaching the end-users.

The responsibility of writing tests falls on the developers. The best way to write automated test cases is to do so as we write new code in behavior-driven development.

Depending on the size and complexity of the software project, this phase can last from seconds to hours. Many large-scale projects run tests in multiple stages, starting with smoke testing that perform rapid sanity checks to end-to-end (E2E) integration tests that test the entire system from the user’s point of view. An extensive test suite is typically parallelized to reduce run time.

Failure during the test stage exposes problems in code that developers did not expect when writing the code. It’s essential for this stage to produce feedback to developers quickly, while the problem space is still fresh in their minds and they can maintain the state of flow.

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

  • Deploy stages

When we have a built a runnable instance of our code that has passed all predefined tests, we are ready to deploy it. There are usually multiple deploy environments, for example, a “beta” or “staging” environment which is used internally by the product team, and a “production” environment for end-users.

Teams that have hold development in Agile model—guided by tests and real-time monitoring—usually deploy work-in-progress manually to a staging environment for additional manual testing and review, and automatically deploy approved changes from the master branch to production.

 

Examples of CI/CD pipelines

A pipeline can start very simple. Here’s an example of a Go project pipeline that compiles the code, checks code style and runs automated tests in two parallel jobs:

What Is the CI/CD Pipeline?

Now that you understand the concepts of CI and CD, it’s time we get more into the weeds of what a CI/CD pipeline is.

A CI/CD pipeline can be easily understood as the process pathway through which we can deliver a single unit of production-ready software. Your team will choose which services they’ll use to build this; there’s no single canonical implementation of a CI/CD pipeline.

The simplest version of the pipeline can best be described by this activity chain:

 

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

 

 

Each of these steps in the activity chain can be handled by a single service or piece of software. Alternatively, you can split the tasks into several different tools.

What Are Your Next Steps?

Here I drop conceptual definitions of continuous integration, continuous deployment, and continuous delivery. Remembering the basics of those concepts will leave you with a good beginning for understanding the other similar concepts, like a CI/CD pipeline.

Most importantly, knowing how having a proper pipeline and its associated practices can bring your IT team in line with the most successful companies in the IT industry. That will make your team attractive to potential hires and more responsive to the fast-changing business environment.

For Free Demo classes Call: 8237077325

Registration Link: Click Here!

 

If your team has not implemented CI/CD pipeline yet, your next step is to plan for it. Talk with project manager and establish a code-freeze week to set up CI/CD pipeline. Remember to keep it simple. Should your team feel unsure about implementing the entire CI/CD pipeline in one shot, phase it in with two stages. My advice is to implement CI first,then you can set up CD on another occasion. You will also want to estimate your team’s velocity in delivering software requirements before and after these changes go live. That’s because, as an IT leader, you need to ensure that your changes are clearly beneficial for the team and company too.

 

Author: Revati  Raspayle

Company:  Seven Mentor Pvt. Ltd.

Call the Trainer and Book your free demo Class for JAVA now!!!

Submit Comment

Your email address will not be published. Required fields are marked *

*
*