Achieve Continuous Deployment with Feature Flags

What are feature flags?

Feature flags are control structures which allow developers to toggle on and off the code inside them. Software development teams use feature flags for a wide variety of purposes, from canary releases to A/B testing, from dark launching to DevOps. Today, let’s take a look at one of the most common use cases for feature flags: continuous deployment.

Feature flags and continuous integration

Many teams implement continuous integration before continuous deployment or delivery, so it’s fitting that we discuss it first. Continuous integration is the process of constantly merging to trunk (or “master”, in Github terminology) to avoid the “merge hell” which often comes of trying to merge many different feature branches created by many different developers or development teams. It saves time in the development cycle – the key benefit of “continuous” anything – by fixing potential merge conflicts early on.

Because teams often set up automated testing as a part of continuous integration, this lays the foundation for both continuous delivery and continuous deployment.

Continuous delivery vs continuous deployment

People often confuse continuous delivery with continuous deployment. They are similar development processes, to the point that they share an acronym (CD), but they have a very important difference in quality assurance and testing. With continuous delivery, developers push every new feature which has passed automated tests to a clone of the production environment, where the new code is manually tested. While continuous delivery is the more traditional development process, as it is much easier for development teams to attain and has more fault tolerance, it is relatively inefficient and frequently creates a backlog of new features waiting for manual testing.

With continuous deployment, however, there is no manual testing process before new code is released to production: any code that passes the automated testing process is deployed straight to end users. This speeds up the deployment process significantly since the deployment of new features is no longer limited by the capacity of the testing team. However, teams implementing continuous deployment (without feature flags) need to be very thorough in their automated testing processes because they are the only safeguard between the new code and the end users. If there is a bug or issue which makes its way through the automated testing, the people who find it will be the users, which will have negative consequences for the company’s reputation and the perceived stability of their software.

Feature flags and continuous deployment

While continuous deployment is possible without feature flags, it is very difficult and the stakes are high. Implementing feature flags adds safety to a continuous deployment process by putting a kill switch on each new feature. If it turns out that a bug made it past automated testing and into a feature release, you don’t need to do a complicated rollback, only turn off the feature toggle. This minimizes the number of end users who are exposed to the error and means you only have to disable the specific feature with the bug, not the entire feature release.

In order to implement continuous deployment with feature flags at scale, many development teams have chosen to use feature flag management systems, which help them to not only use feature flags but track them. This way, they can see the status of their features and feature flags, and retire old or outdated features and remove feature flags which are no longer in use. In addition, many feature management platforms are open source, which enables third-party integrations and add-ons as well as personalization.

In addition to using feature flags to manage continuous deployment, you can also take continuous deployment to the next level with something we will call micro-deployments. These are ultra-small code deployments which allow you to deploy one feature at a time whenever they’re ready instead of bundling multiple features into a larger package. This enables maximum release speed, allowing development teams to get new features in front of users at essentially the pace they’re created.

Conclusion

The use of feature flags can facilitate continuous deployment and micro-deployments and can improve the effective quality of your software by reducing the visibility of bugs and errors to end users while simultaneously speeding up your software release train. If you’d like to try using feature flags and seeing how they can benefit your development team, you can sign up for a free trial of Split right now.