CI/CD is a set of methods that enables application developers to deliver code changes more frequently to customers using automation.
The acronym CI/CD refers to two separate concepts that are generally used together: continuous integration and continuous delivery.
- Continuous integration refers to an automation process that developers use to build, test, and merge application code changes.
- Continuous delivery is the next step in the process where the tested code from continuous integration is automatically deployed in various environments by a manual trigger.
CD can also stand for continuous deployment, which introduces further automation. In continuous delivery, developers need to push changes to their production environment manually. By using continuous deployment instead, developers can have application changes automatically deployed to any environment.
How CI/CD Works
The modern, fast-paced world of application development demands that multiple developers work on a single app simultaneously. In a standard lifecycle, once developers are ready to test their changes, they merge their individual code changes on a predetermined “merge day.” The merging process is tedious and labour-intensive. It becomes even more intensive if a developer’s change affects another developer’s change, ultimately forcing the team to rollback or spend hours on bug fixes.
The continuous integration phases
Converting to a CI/CD process helps developers merge and test code more frequently, even daily.
The continuous integration phase follows these basic steps:
- A developer takes code from the shared repository to work on it, possibly creating a new branch for a new feature.
- Once the new feature is complete, the developer pushes it back to the shared repository.
- The CI server determines that changes have been made and begins to build and test the application, ensuring that the changes have not caused the application to break. The tests focus on total functionality to ensure that no part of the application has been compromised.
- The development team is notified of the test results. In the event of a failure, the team will know that the new code has caused the failure and can begin to isolate and fix the issue. If the changes are successful, the team moves on to the continuous delivery phase.
The continuous delivery bit
Once thorough testing has taken place, teams can move on to the continuous delivery phase. The delivery of code must be manually triggered by a developer, but the rest of the process is entirely automatic. All necessary interaction with web servers, databases, and other services is done with the call of a script.
Continuous integration and continuous delivery require continuous testing because the goal is to deliver high quality and secure applications and code to end users. Continuous testing is often deployed as a set of automated regression, performance, and other tests that are executed within the pipeline.
CI and CD together (CI/CD) encompass a culture, a set of operating principles, and a collection of practices that accelerate the software development process. The implementation is also known as the CI/CD pipeline and is considered one of the best practices for devops teams.
Industry experts say more organizations are implementing CI/CD as they look to enhance the design, development, and delivery of software applications to be used internally or by customers.
What you need (cost)
- Your team will need to write automated tests for each new feature, improvement, or bug fix.
- You need a continuous integration server that can monitor the main repository and run the tests automatically for every new commits pushed.
- Developers need to merge their changes as often as possible, at least once a day.
What you gain
- Less bugs get shipped to production as regressions are captured early by the automated tests.
- Building the release is easy as all integration issues have been solved early.
- Less context switching as developers are alerted as soon as they break the build and can work on fixing it before they move to another task.
- Testing costs are reduced drastically – your CI server can run hundreds of tests in the matter of seconds.
- Your QA team spend less time testing and can focus on significant improvements to the quality culture.
What you need (cost)
- You need a strong foundation in continuous integration and your test suite needs to cover enough of your codebase.
- Deployments need to be automated. The trigger is still manual but once a deployment is started there should not be a need for human intervention.
- Your team will most likely need to embrace feature flags so that incomplete features do not affect customers in production.
What you gain
- The complexity of deploying software has been taken away. Your team does not have to spend days preparing for a release anymore.
- You can release more often, thus accelerating the feedback loop with your customers.
- There is much less pressure on decisions for small changes, hence encouraging iterating faster.
What you need (cost)
- Your testing culture needs to be at its best. The quality of your test suite will determine the quality of your releases.
- Your documentation process will need to keep up with the pace of deployments.
- Feature flags become an inherent part of the process of releasing significant changes to make sure you can coordinate with other departments (Support, Marketing, PR…).
What you gain
- You can develop faster as there is no need to pause development for releases. Deployments pipelines are triggered automatically for every change.
- Releases are less risky and easier to fix in case of problem as you deploy small batches of changes.
- Customers see a continuous stream of improvements, and quality increases every day, instead of every month, quarter, or year.
One of the traditional costs associated with continuous integration is the installation and maintenance of a CI server. But you can significantly reduce the cost of adopting these practices by using a cloud service like Bitbucket Pipelines which adds automation to every Bitbucket repository. By simply adding a configuration file at the root of your repository you will be able to create a continuous deployment pipeline that gets executed for every new change pushed to the main branch.
CI/CD is a combination of two concepts: continuous integration which builds and tests applications after code changes and continuous delivery which pushes approved changes to a variety of environments.
Using CI/CD pipelines for mission-critical applications can reduce the risk of code changes through small, incremental updates by isolating the effect that bugs can have on an application.
About Codacity Informatica Group
We are at our heart, engineers who love change and delivery. That what makes us stand out. We recognize that systems must always start and end with clean code. CIG can power your software development transformation from ideation to execution and benefit delivery. We have more than 18 years of experience driving business change in many settings. We are ready to enable you today.