Basics Of CI/CD

Snehal Shinde
Globant
Published in
6 min readJul 8, 2021

--

Photo by EINFOCHIPS PES on Einfochips

Have you ever wondered How much time will be needed to ship the software to production?

Years? Months? or Days?

A growing number of companies are shipping software in minutes. Yeah, in Minutes. And all this is possible with the help of CI/CD.

But what it exactly means and why we need it, we can get a fair idea about this in this article.

Why CI/CD :

Often, teams struggle to ship software into the customer’s hands, on time and on budget. This is due to a lack of consistency and excessive manual labor. But CI /CD delivers software with speed, safety, and reliability.

  • CI/CD improves code quality and delivers faster releases.
  • It Shortens the time-to-market of new features.
  • Automation reduces costs and manual interventions.
  • CI/CD Streamlines communication between teams with a rapid feedback loop.

What Is CI/CD :

Continuous Integration:
Continuous Integration is a practice followed by the developers. Which includes time-to-time check-ins to a shared repository. These checkings are called Push. Each push is verified by an automated build to detect any problems early stage. This helps to locate the problem more easily. With CI, The integration happens after a “git push”, to a shared repository.

Continuous Delivery :
Continuous delivery (CD) picks up where continuous integration is over. While CI is the process to build and test automatically. CD deploys all code changes to the testing or staging environment in the build.

CD aims to reduce the friction points in the deployment or release processes. . Team’s implementation involves automating each of the steps for build deployments. So that a safe code release can be done at any moment in time.

To make CI/CD a reality, you need to automate everything that you can in the software delivery process. And run it in a CI/CD Pipeline.

Let’s see what is CI/CD pipeline is.

CI/CD PipeLine :

Photo by Izzy Azeri on Mabl

Stages of CI :

1)Push
2) Test
3) Fix

  1. Push to master every day
    While working on any software, It is divided into the no of features. Multiple developers work on the same feature which togetherly makes complete software. CI practice is about pushing code into the master branch. Because that’s the branch that is going to be used to release software. This “push to master” stage is also known as trunk-based development.
  2. Test
    CI relies on an automated and reliable suite of tests. These tests validate the code integrated by the developers. You can include as many tests as you consider critical. But to determine that, remember that CI’s purpose is to provide feedback as soon as possible. If a developer has to wait an hour to get feedback, it won’t work. So Keep the CI loop as short as possible. You might have to lean heavily on unit testing and lightly on integration testing.
  3. Fix the broken build
    If you observe any build is broken, then fixing it should be the priority for the team over adding a new feature to it. The idea behind fixing a broken build is that the build is always going to produce releasable working code.

Principles of CD:

https://www.consultancy.uk/illustrations/news/detail/2018-11-23-083138276-Continuous-Delivery---the-eight-principles.jpg
Photo by consultancy.uk on CD principles

1. Repeatable and reliable process for deploying software

For easy deployment, it is important to use the same release process for all environments. It will help to maintain consistency. If we use different processes for different environments, issues find a way of popping up. So to avoid it use the same release process in all environments.

2. Automate everything

Human time is very expensive. And it should be spent on creative exercises instead of playbook task running. So automate as much as you can. Automate your builds, your testing, your releases, your configuration changes, and everything else.

3. Continuous Improvement

Out of all principles of CD, It is the most important for effective automation. It will help you from falling behind with the ever-evolving advancements in technology. It ensures that you track change and improve your processes to match it.

4. Keep everything in version control

Keeping all development, deployment, and testing aspect versioned is the key to CD. Code, configuration, scripts, databases, documentation. Everything! Keep it versioned. It ensures a stable foundation for creating repetitive processes with efficiency.

5. Build-in quality

Create short feedback loops to deal with bugs as soon as they are created. This will enable developers to produce higher-quality code quicker. Also, very few issues will be found later on, when it will be more expensive to fix.

6. Done means released

For CD there is a clear definition of what the final version of the software should be for production. It removes any ambiguity if there. And helps everyone to reach and deliver the agreed-upon final version.

7. If it hurts, do it more frequently, and bring the pain forward

It is important to deal with time-consuming or error-prone tasks first. Repeated application of these problematic procedures will enable faster detection and repair of the underlying issue.

8. Everybody is responsible

“It works on my station” is never a valid excuse. Responsibility should extend to production. Cultural change can be the hardest to implement. Yet, having management support and an enthusiastic champion will certainly help. Everyone must share responsibility and accountability throughout the whole process.

Tools Of CI/CD :

Photo by tech greek on DevOps Interview Questions

Jenkins is a powerful Java-based tool and is widely used. It is mostly known for its flexibility. It is an open-source automation server is written in Java. It also supports version control tools like Subversion, Git, Mercurial, and Maven. It is well-documented & extremely extensible, with a rich ecosystem of plugins and integrations.

GitLab is a web-based Git repository manager. It has a wiki, issue tracking, and CI/CD pipeline features, using an open-source license.

CircleCI is a lightweight cloud-based CI/CD platform. It automates build, test, and deployment processes. It has a readable YAML configuration, is painless to set up, and does not need a dedicated server to run. It is suitable for small projects that need to get off the ground fast.

Codeship by CloudBees is a hosted Continuous Delivery platform. It helps to release software quickly, automatically, and many times a day. It integrates with GitHub and BitBucket. Automatically deploying when tests pass. Notifying you when tests or deployments have failed.

GoCD is an open-source software development tool that automates the CD of software. It has value stream mapping, cloud-native deployments, complex workflow modeling, and advanced traceability.

Apart from these widely used tools, there are a few more tools available in the market. Like Azure, Spinnaker, Travis CI, Buddy, Bamboo, and many more. You can choose any of them as per your need and suitability.

Have you been using CI/CD tools in your project? If not, you should give it a try. CI/CD is the way to go.

Conclusion:

Overall CI/CD improves velocity, productivity, and sustainability of the software development team. The team can respond faster to the changes in the marketplace. There are less tedious and repetitive tasks. It leads to a happier team that lasts longer and produces better products.

--

--