Planning for failure by implementing automated or manual rollback procedures.
Despite extensive testing, issues can sometimes slip into production. A critical part of a mature CD pipeline is a well-defined rollback strategy. The goal is to quickly revert to a previous, stable version of the application to minimize the impact on users. The implementation of a rollback depends on the deployment strategy being used. With a Blue-Green deployment, a rollback is as simple as switching the load balancer back to the old (Blue) environment, which is nearly instantaneous. For Rolling deployments, a rollback might involve redeploying the previous version of the application using the same rolling update mechanism. In a CI/CD pipeline, rollbacks can be automated or manual. An automated rollback might be triggered by monitoring tools that detect a spike in errors or a drop in performance immediately after a deployment. The pipeline would then automatically execute the steps to redeploy the last known-good version. Manual rollbacks are triggered by a human operator after an issue has been identified. The pipeline should still provide a 'one-click' rollback job to make this process as fast and error-free as possible. It's crucial to not only have a rollback plan but to practice it regularly. This ensures that the process works as expected and that the team is prepared to act quickly when a real production incident occurs.