Can any member of your development team stop what they’re doing right now and ship the current development version of code to production? Will it be shipped in 20 minutes or less? And without anyone stressing about what might go wrong? Yes? Then congratulations, you’re doing CI/CD!
No? Then read on to learn why rapid CI/CD is essential for your team and the key steps you need to take to start your CI/CD journey.
Why your team needs fast CI/CD?
More than just automation of processes to reduce errors, CI/CD enables you to deliver new solutions into the hands of users as efficiently, quickly, and cost-effectively as possible.
Too often, optimizing a software development process is seen as a production-line problem. But focusing effort on building and managing capacity to design and implement features isn’t enough on its own.
In fact, software development is all about learning, experimentation, and discovery. Companies that practice Continuous Delivery optimize their learning cycle. Therefore, they produce higher-quality software more quickly. Teams enjoy their work more and their organizations make more money.
1. Deliver software with less risk
CI/CD pipelines reuse tried-and-tested release processes across projects. Also, a process of automatically testing every source code change means you lower the chance of releasing buggy software.
2. Release new features more frequently
A CI/CD tool visualizes your entire path from commit to production. From that overview, you can spot inefficiencies and optimize your process. By removing the bottlenecks to productivity, you boost your company’s efficiency.
3. Deliver the product that users need
Being able to release often increases the quality and granularity of feedback. You can gain an advantage by A/B testing features, or by trialing early versions of features with select customers. This way you focus on the features that matter and avoid investing too much in features that your early feedback tells you customers don’t need.
4. Improve developer productivity
Stress is common in engineering teams that don’t practice CI/CD. Time is wasted firefighting the fallout from bad deploys and hard-to-fix outages. Effective code reviews are impossible on long-lived feature branches that grow and tangle between releases, so code degrades in quality.
On the other hand, CI/CD helps you optimize for user impact. Developers deploy small code changes while they’re fresh in their minds. The outcome is a happy team.
The benefits of CI/CD compound: fast deploy cycles and frequent releases reduce risk, so there’s less fire-fighting, faster learning, and more user feedback. The result is a happier team creating better products.
Essential Steps To Start Your CI/CD Journey
If long development cycles are what you’re used to, you’ll need to shift your mindset.
You need to think of anything that pushes you over a 20-minute lead-time for your CI/CD pipeline as technical debt and treat it accordingly. Estimate the work needed to optimize the process, set clear expectations with all stakeholders, and plan in time to fix it.
The main areas to focus your efforts are:
- Automating builds
- Automating testing
- Automating deployment
Your team needs visibility of the process and real-time access to CI/CD status to support their efforts.
Teams new to CI/CD should take small steps, continuously improving code and process to help the organization grow. Every step will win the team enhanced productivity.
1. Make sure your master branch is always ready to deploy
Don’t disable failing tests. File a ticket and fix them! Always run tests locally before committing and don’t check-in a broken build. Never go home on a broken build – revert your changes instead. If you don’t already follow this principle, it will be hard. Push through, it’ll get easier and it’ll be worth it!
2. Treat every test fail as a real problem
This includes flaky tests – don’t be satisfied with rerunning tests until you get a pass! Extract the log, investigate and fix the root cause. Don’t close the issue until you’re satisfied it’s fixed.
3. Improve your test suite
You might have to re-engineer code to improve test reliability. Take the same care writing test code as you do with production code. After a while, you’ll become confident that test failures point to real problems. Eventually, you’ll hit 100% green CI builds. That’s your first mountain conquered! Celebrate!
The benefits of maintaining a fast and comprehensive automated test suite are worth the big upfront investment. Testers and QA are freed for exploratory testing and do much more that takes advantage of their imagination and ingenuity. When developers have confidence that a green CI result means no unforeseen issues, development velocity sky-rockets.
4. Avoid long, tangled feature branches
Use feature flags instead of branches. Pushing to master means merge conflicts are resolved little and often. Feature flags also mean it’s easy to integration-test features in development with the rest of the system. Issues are detected right away instead of when merging weeks or months later.
5. Shorten your feedback loop
Aggressively improve or rewrite slow tests to make them faster. Invest in a CI/CD tool that makes it easy to parallelize your build and tests. This way, developers get into the habit of fully testing every pull request before merging it.
6. Automate deployment
Begin transforming a manual deployment process by documenting it as a series of tasks. Automate each task, one-by-one, with a script (Bash, Makefile), or a configuration management tool such as Puppet, Ansible, or Chef. When each task is automated, you’re ready to assemble an automatic pipeline.
7. Employ ‘Infrastructure as Code’ techniques
For cloud deployments, automatically stand up infrastructure with tools such as AWS Cloudformation and Terraform. For on-premises deployments, you will probably not be able to create and destroy production-like environments on-demand – but you can still arrange for test environments to be always available.
One Step at a Time
As you take the 7 steps, your team will start releasing monthly, then weekly, then daily. You’ll deliver more value more often and have more fun doing it. Good luck!