What is feature flag in DevOps?
Feature flags have become very popular among DevOps and software development specialists. Feature flags can have many purposes and help implement features safely and quickly. Check out, what feature flags are, the pros and cons of this solution, and how to implement feature flags in your organization.
Feature flag in DevOps?
Feature flags, known also as feature toggles can be referred to as a software development tool that makes it possible to switch a piece of the app’s functionality on and off, in order to safely test it. Featureflag implementation allows the activation and deactivation of new features in a production environment, without having to make code changes. Using feature flags can be treated as a kill switch to instantly disable a code with bugs. Feature flag implementation allows faster software delivery.
We can distinguish many types of feature flags. The most well-known categorization is based on longevity and dynamism and can be divided into:
- short-lived and long-lived;
- static and dynamic feature flags.
What are the benefits of feature flags?
Implementing feature flags can bring value to the new feature development and shorten the release process. What are the main benefits of feature flagging?
One of the challenges of the development teams is the delivery and control of new feature releases. Continuous Integration (CI) and Continuous Delivery (CD) with feature flag management allow the engineering teams to merge multiple features into one shared repository, without the possibility of breaking something or allowing users to access features that are not finished yet. A feature toggle minimizes the risk of having feature branches.
Testing in production
A feature flag platform is a powerful tool that enables the development team to test in production and control access to the new code. A feature flagging platform helps to detect problems in production and fix them as fast as possible. The engineering team uses feature flags to decouple code deployment from the feature release.
User segmentation is another application in which feature flags can be used. Software engineers can choose certain users to be given early access to the app, or the other way around – block some users or introduce environment variables to enforce different requirements.
Feature flag implementation – how to do it?
One approach to implementing feature flags is to use a configuration file. The code is loading the value of the config file to the memory and depending on what the value is, decides the code paths, with an if-then instruction.
The second way to leverage feature flags is to implement feature flag management software. If you are looking for such a solution check out https://www.getunleash.io/.