Understanding CI & CD
While many of us may understand the basic principles of what CI and CD are, it is also crucial that we understand the differences.
CI and CD are acronyms that are used very often in modern software development. If you do not know what the acronyms stand for, let us inform you.
CI is an acronym for Continuous Integration, which is a practice in which developers will regularly connect code changes together into a central repository. This is where automated tests and builds will be run.
Then there is CD, which stands for Continuous Delivery. This is a practice in software development in which changes are released to production.
CD could also mean Continuous Deployment, however, we are looking at Continuous Delivery today.
Continuous Integration and Continuous Delivery work together to make the software delivery process faster and more efficient.
To understand more about what CI and CD are, look here: https://harness.io/blog/what-is-ci-cd/, to learn about their differences, keep on reading!
What Is CI?
Those who practice Continuous Integration connect the changes they made to the primary branch frequently. Then the changes of the developer will be confirmed as they craft a build and run automated tests against this.
This process helps you find bugs and fix them prior to release into production.
CI puts a lot of emphasis on the automation of testing in order to be certain that the application functions whenever anything new is merged into the primary branch.
What Is CD?
Continuous Delivery takes the artifact that was produced in CI and gets it ready for deployment into production.
Continuous Delivery helps you deploy on a – you guessed it – continuous basis. While releases, in the past, were mostly done in sprints, doing CD correctly allows you to deploy multiple times per day, if needed. This also allows you to deploy small batches of code at a time, instead of large changes that may have more risk of errors.
How Do They Relate?
CI and CD work together to make the software delivery process efficient. CI takes your build, tests it, and turns it into an artifact, which then goes into CD, where it’s deployed to your production environment. So while they are different processes, they work together to form a complete pipeline.
CI Costs & Gains
There are certain costs and gains that come with using Continuous Integration, so let’s look into these first.
What Are the Costs of CI?
First, you will need to write up automatic tests for each feature you desire, as well as improvements or fixes required.
You will also need to ensure you have a CI server that is able to manage the main repository and has the capacity to run the required tests on an automated basis for every new commit that is pushed.
Your developers will also be required to connect all of their changes on a frequent basis. It is recommended that this should be done at least once per day.
As far as monetary costs, it all depends on the CI tool you decide to go for. There are open-source CI solutions like Drone, Concourse CI, and Jenkins that don’t cost a thing up front, but you do need to factor in the cost of maintenance. This can be measured in DevOps/Developer time.
Some paid CI systems are quite worth it, as they take a lot of that maintenance and toil away by removing the pain of scripting.
What Are the Gains of Using CI?
As a result of using CI you will find that there are fewer bugs that will be sent into production. This is because they will be easily caught by the tests you automate.
The release of your builds should be easy as all of the issues you would have had prior will now be solved much earlier on.
There will be less context switching as the developers will be alerted sooner as they are breaking the build and can work on amending any issues prior to moving on to other tasks.
Your costs from testing will be decreased as having a CI server will make you able to run more tests in a short time frame.
CD Costs & Gains
There will also be certain costs and gains from using Continuous Delivery.
What Will Using CD Cost?
To use CD, you will need to have a formidable foundation in your CI systems and in your testing base to cover a sufficient enough proportion of your codebase.
Your deployments will also need to be automatic. While the trigger will maintain its manual status, once you have initiated a deployment there should be no requirement for any manual action.
The team you have on this will need to become accustomed to featuring flagging so that any incomplete features will not end up affecting customers in the process of production. While not every company that does CD does feature flags, we find them an extremely helpful part of the software delivery process. CI/CD/FF together complete your pipeline.
As far as financial costs, it’s the same as CI: there are open-source tools and paid solutions. And while open-source is technically free, do remember the costs that are associated with developer hours.
What Do You Gain From Using CD?
Once you start using CD, you will find that the complexities of deploying your software will diminish. CD is a time-saver, and it allows you to release at a greater frequency.
This will in turn speed up the feedback you get from your customers as well.
You will also find there to be a great decrease in the pressure felt on your team when it comes to making decisions around smaller changes. Truly, CD can help improve the Developer Experience dramatically.
What Are The Key Differences?
So, let’s go over what we have learned so far and put it all into simpler terms for us ALL to wrap our heads around, analyzing the key focused differences between Continuous Integration and Continuous Delivery.
Continuous Integration builds, tests, and produces an artifact that is ready to be deployed. On the other hand, Continuous Delivery takes that artifact and deploys it to production.
CI Pros & Cons
- CI makes it possible for you to test automatically instead of manually.
- Testing in CI helps catch bugs before they get to production.
- CI tools usually track build history, making it easy to see where something went wrong.
- Should you have any issues, feedback will be immediate.
- CI will help you build better software.
- You will find visibility and communication increases by using CI.
- CI, done right, is extremely scalable – as your business scales, your CI pipelines will scale with you.
- Adoption can be an issue, as new CI tools can be complex to learn.
- Figuring out which tests to run for each separate use case can be difficult.
- CI tools, especially older ones, can require scripting.
- In addition to scripting, some CI tools do require lots of administrative/maintenance overhead.
CD Pros & Cons
- Using CD means your software release process will be automated, which makes software delivery more secure and quick.
- Governance features, such as RBAC, secrets management, and audit trails make CD a great choice for companies in sensitive or highly-regulated industries.
- There will be less pressure on the decisions needed to make small changes.
- You will be able to release softwares more often which will, in turn, speed up feedback.
- Your team will need to be very coordinated and communicate well as changes in code should be collated frequently and efficiently.
- Oftentime, people will use a CI system and script/extend it to do CD. While it works, it can cause issues down the road – using a CD tool for CD is much more prudent.
The Problem With Only Focusing On Continuous Integration
Knowing the difference between CI and CD can stop you from falling into a pitfall of confusion. Many companies think CI/CD is one thing, and so only focus on the Continuous Integration side and completely ignore the Continuous Delivery side.
Just because you have a good Continuous Integration system where the server is merging code constantly doesn’t mean that the Continuous Delivery process is automatically engaged. For example, your team could be testing code and pushing changes a couple of times a day, but without deploying the changes continuously, too, all you are doing is troubleshooting. Troubleshooting is essential, of course, but it doesn’t give you a truly continuous system by itself.
Ideally, a good Continuous Delivery system will have its own software. This is so the two systems don’t create conflicting commands or take up space as they compete with one another. The automation should be smooth. The best way to keep everything running as it should is to use specific tools for the job – specific software for CI and specific software for CD.
If you fail to recognize the difference between the two software systems, you can end up creating these disadvantages:
- The complex nature of deploying software is still a problem for the team.
- You will spend days preparing for a release, even though CI/CD is meant to remove this problem.
- You won’t be able to release software faster, as that process is connected to Continuous Delivery and not Continuous Integration.
- The feedback loop with your customers will remain slow.
- Changing small details will still feel stressful as the process has remained slow.
Although you need to have Continuous Integration before you can use Continuous Delivery, without the CD element, your work schedule and speed will not change dramatically. You need both to reach optimized processes.
Moving From CI To CD
When you are just starting out, the low number of users means deploying your commit to production should be easy. If you can set up your automation process at this point, then it will make everything smoother when more users arrive.
If you want to get started before the customers arrive, you can create an automation process to automate your deliveries and deployments.
With the automation set-up, you can put more pressure on your tests to confirm if the increase in code coverage can be handled. This low user testing culture is the perfect set-up to see how your CI/CD is developing.
On the other hand, if you already have customers in your application, then you shouldn’t make dramatic changes all in one go. Instead, start slowly. You could implement a basic unit testing process and see how the changes unfold. There is no point in setting up complex tests yet, as a simple mistake could halt your customer’s usage.
Instead, you should focus on advancing your tests to create a more secure and functional environment. Arguably you could set up a Continuous Delivery set up first, so your tests are continuously released once completed. However, depending on how willing you are to only set up part of the CI/CD process, you may want to hold off until the whole automation line can be completed.
Continuous Deployment is a whole other kettle of fish, and you should only consider it when your CI and CD process are secured and functioning properly.
Leaping From Continuous Delivery To Continuous Deployment
Although we have discussed deployment within Continuous Delivery, we haven’t actually talked about Continuous Deployment. Earlier, we explained that these are different CD systems that often get confused with each other. We will explain the differences between the two and how they fix together.
As you know, Continuous Delivery is about automating software release processes. One of these manual steps could be to approve starting the deployment process.
Continuous Deployment, however, takes it one step further. Every change added or removed to the source code is automatically deployed into the production environment. There isn’t a step for developers to manually approve the change, therefore releasing them from another task.
This means that the last task in the developers’ job isn’t reviewing the changes as it would be in Continuous Delivery. Instead, it ends at reviewing a pull request into the master branch.
A Continuous Integration and Continuous Delivery system takes control of the testing and deploying the code while keeping the developers informed about the results. Whereas a Continuous Integration and Continuous Deployment system don’t inform the team about the changes.
Instead of making sure everything is okay before you press launch, you can monitor the outcomes and fix any problems when released in the updates. For Continuous Deployment to work well, the team has to invoke a culture of monitoring and recovery. Spotting issues as they appear and fixing them as soon as possible.
The Boundaries Between Each Concept
People often get CI confused with CD, and many people still don’t know the difference between the two CDs. Keeping their definitions separate can help you understand their individual abilities.
Continuous Delivery is considered a loose concept in comparison to the other two, as you can apply the system to either one service or your entire organization.
Continuous Integration or Deployment, however, are stricter systems that need to stay automated to work as intended.
To wrap things up, CI and CD are different tools in the same toolbox.
CI is the first step in the software delivery process – it helps you turn your code into an artifact that is ready for deployment.
However, deployments will still be done manually if you only use CI.
Adding CD to your pipeline helps automate the deployment process, and allows for smaller, more continuous deployments.
Using these in your business will help to speed things up a lot and take a great deal of stress and pressure out of the entire process. While tools do require some training, the benefits far outweigh that small time cost!