You’ve heard the buzz, but what does it mean for you, and how can you ensure a successful implementation? Continuous Integration (CI) and Continuous Delivery (CD) are practices in modern software delivery whose effective implementation help speed development, ensure quality and reduce downtime. Continuous Integration is the practice of automatically performing builds and running tests when code is committed or merged in a source control system, such as git. Continuous Delivery takes this further and automatically deploys the software to a production environment once it passes a set of automated smoke tests.
Though many development projects never achieve this level of sophistication, pursuit of these two practices can provide value to any development team. As a consulting firm with a history of building out enterprise CI/CD platforms, Nortal is often sought out for its expertise in implementing these practices. In fact, the No. 1 reason clients seek our help with CI/CD is because they want to have faster production releases. Whatever your organization’s level of CI/CD maturity, we can help your teams improve their practices and maximize the benefits of automation.
The following are several tips we’ve found helpful for a successful CI/CD implementation:
- Use a CI/CD platform: Every modern development organization should be using a CI system. If your enterprise has no requirement to deploy its own solution there are numerous excellent SaaS options, such as CircleCI or Travis CI. SaaS models eliminate long-term ownership and maintenance of server hardware and software. If you choose to use on-premise software, GitLab is a good option that supports many CI/CD best practices
- Establish automated testing for your builds: Once code is compiled and an artifact built, establish a process for automatically testing your builds using unit, integration or functional tests. Run these tests every time you build the product so that you know that in every build, nothing has changed that will break the code or alter the anticipated behavior.
- Automate deployment in your lower environment first: Unless you have a fully mature automated CD pipeline to production, a good practice is to automate at least a deployment for each build to a dev or QA environment. Building confidence in your automation and testing is the shortest path to maturity, and to reducing the lag time in deploying completed code to production.
- Use blue-green/canary deployments: When a production deployment is released in tandem with an existing release and traffic is bled over to the former from the latter, you are doing a blue-green deployment. When automated smoke tests run against a portion of production traffic driving an automated decision to roll forward or back you are doing a canary deployment. These types of deployments allow for testing and easy rollback and are valuable tools in ensuring production systems remain functional. When instituted properly, they give confidence to every release and allow deployments to happen more often, and with less ceremony. A primary goal here is that deployment should be cheap.
- Give your developers production access: Historically, there’s been a wall between development and operations teams. This made sense when hardware in a data center required physical access and wiring skills. In the cloud, however, with scriptable virtual networking, an advanced development team can perform operational functions in a practice dubbed DevOps. While your organization may continue to have operations specialists, providing the dev team production access and responsibility is one of the best ways to ensure builds and deployments function smoothly and automation is robust. Even if organizational policies limit them to read-only access this can be vital for debugging production issues and ensuring that devs are intimately familiar with your selected cloud platform.
- Reduce the amount of time that completed code exists outside production: Any code that is complete but not released to production is waste. It is analogous to unsold inventory sitting on a store shelf. It is therefore a high priority to move completed code to production as soon as possible. In addition to reducing waste, short deployment times lead to much faster feedback cycles. One factor in reducing the amount of time completed code is in process is to reduce the time it takes to run tests. When possible, tests should be run in parallel and all tests should provide real value. Unreliable tests are, of course, verboten.
- Don’t release bad builds. Ever: There are two primary purposes for the automation instituted by CI/CD, 1) speed the delivery of code to production, and, 2) provide checkpoints that prevent the delivery to production of flawed code. It is the responsibility of the automation to discover problems and prevent them from causing production issues. Properly instituted, CI/CD can prevent all manner of ills. They should be seen as guardrails for the development team that remove the vagaries of manual builds and deployments. This only works if the automation works smoothly, autonomously, and with adherence to the inviolable rule that a test failure results in a rollback of the flawed code, preferably prior to a production release.
- Measure twice, code once: When code is delivered to production, you can’t afford to discover that it doesn’t perform under your production load. Therefore, testing under production-like load is necessary when any performance-impacting change is made. Ensure you are accurately modeling your production load in a load-testing environment. Tee your production traffic to your performance testing environment, if possible. Once delivered to production, use telemetry data from your application to ensure it is performing well and, when possible, implement auto-scaling. Test your scaling behavior in a non-production environment.
These time-tested tips should help you implement CI/CD in your organization, improve the quality of your software, reduce the time required to deliver code to production, and increase the velocity with which you can turn business requirements into user-visible functionality. Ultimately, CI/CD provides confidence in your development teams, in your automated processes, and in the quality of your product and they are a vital part of modern software development. If you need assistance implementing any of these practices, contact us and we’d be glad to help.