Continuous Delivery (CD) is a software development practice where code changes are automatically built, tested, and prepared for a release to production. It expands upon continuous integration by deploying all code changes to a testing environment and/or a production environment after the build stage.
When continuous delivery is implemented properly, developers will always have a deployment-ready build artifact that has passed through a standardized test process.
Automated Testing: In CD, testing is automated and is a critical part of the delivery pipeline. This ensures that any bugs or issues are caught early and can be fixed before deployment.
Deployment Pipeline: This is the key component of CD. It is an automated manifestation of the process for getting software from version control right through to the user.
Continuous Integration: CD is an extension of continuous integration, as it automatically deploys all code changes to a testing and/or production environment after the build stage.
Release Process: The final stage of CD is the release process. This is typically a manual step that involves a final check and approval before the changes are released to the production environment.
Let's consider a software development team working on a web application. They use a version control system to manage code changes and have a suite of automated tests that validate the functionality of the application.
When a developer makes a change to the application code, they commit their changes to the version control system. This triggers the continuous delivery pipeline.
First, the application is built. This includes compiling the code, packaging the application, creating database schemas, and so on.
Next, the built application is automatically deployed to a testing environment, and the suite of automated tests is run against the application. This could include unit tests, integration tests, and functional tests.
If any of these tests fail, the continuous delivery pipeline is stopped and the team is notified so they can fix the issue. If all tests pass, the application is automatically deployed to a staging environment.
In the staging environment, further testing is conducted. This could include user acceptance testing, performance testing, and security testing.
Once the application has passed all stages of the continuous delivery pipeline, it is ready for release. The final decision to deploy to the production environment is a manual one, and is typically done by the team when they are confident that the application is ready.
In summary, continuous delivery ensures that software is always in a releasable state. It does this by ensuring that every change to the system is releasable, and that we can decide to release it at any time. This makes it easier to deliver updates to users more frequently and with less risk.