#FeatureFlags
Feature flags or feature toggles are a powerful software engineering technique to turn select functionality on and off during runtime without deploying new code. This helps teams to make changes quickly without pushing additional code, thereby enabling more controlled experimentation over the lifecycle of features. As a result, feature flags help many novel workflows that are extremely useful to an agile development cycle and CI/CD environments.
Agile software development teams are trying to roll out new features with shorter sprints and continuously deploy software. A CI/CD pipeline is imperative to accelerate the velocity of code deployments. However, to move quickly without increasing the number of code rollbacks, there need to be safety measures in place. Feature flag is one such technique that helps turn off a feature without impacting the code in production or necessitating a rollback.
Put simply. feature flags allow dev teams to decouple deployment from release, helping teams manage the full lifecycle of a feature. They go by many names:
Toggling a feature helps use known information to control how the code works. For instance, if new features are rolled out to internal users for testing, a feature toggle can control access and allow employees logged into an app with a corporate email to see the feature. The feature will not be visible to other users. This helps because it eliminates the need to maintain long-running and multiple feature branches in the source code. All you need to do is use flags and make the changes to the primary branch when it is ready.
So, is it just useful for engineering or development teams? Feature flags can be leveraged by:
Unleash is one of the most popular feature management solutions available today. What makes it even more attractive is that it is open source and offers great flexibility as compared to commercial off-the-shelf solutions in the market. Unleash enables integrations with the teams’ broader tech stack, allowing companies to gain full control of their data with self-hosting. This is quite relevant in the context of stricter data regulations such as GDPR, CCPA, and CPA. Unleash allows companies to configure their rollout strategies so only a specific group of users will be able to see, test or use a new feature.
As the largest open source solution on GitHub for feature flagging, Unleash offers 12 official client and server SDKs and 10+ community SDKs. In fact, one can develop their own SDKs if they like and use Unleash with any language and framework.
There are a couple of other open source alternatives such as Flagsmith and FeatureHub but Unleash remains one of the most popular choices there.
You can deploy new features in your application in GitLab in smaller batches with feature flags. All you need to do is toggle a feature on and off for a subset of users, to help you achieve continuous delivery. This enables you to carry out controlled testing and separate feature delivery from customer launch, minimising the risk and improving the release-readiness.
GitLab uses Unleash for feature toggling. Developers can enable or disable a flag in GitLab to enable or disable features. Users can leverage feature flags in GitLab by using the application’s API to get a list of feature flags and their statuses.
Users need to start Unleash after ensuring git and docker are installed. They can find their preferred SDK in their list of official SDKs and import into the project. The configuration guidelines will vary based on the SDK selected. Alternatively, users can also run Unleash on a service if they don’t want to run it locally.
The advantage of using a feature toggle service like Unleash with Gitlab is that you can apply a feature flag strategy across environments without defining it multiple times.
Unleash offers strategies for granular feature flag controls. Gitlab feature flags can use multiple strategies and this is what is currently supported:
It is evident that feature management is essential to continuous release and deployment, helping developers and other teams to roll out new features incrementally, turning features on/off and carrying out A/B testing to find what works best without shipping a new version. Essentially, it gives teams more control over the end product and allows them to experiment without risking code roll-back. Here are some of the key advantages of using feature flags:
Engineers use feature toggles to do ‘soft rollouts’ for new product features. The feature flag can be set to off by default so that once the code is deployed, the feature remains dormant during production unless activated. Developers choose when to turn the feature flag on, allowing testers to perform QA and feedback on the behaviour. If the team identifies any issue in this phase they can immediately turn off the feature flag to disable new code and minimise the exposure.
Agile and innovative teams can use feature flags combined with system monitoring and metrics for any observable issues. For instance, if an application witnesses a spike in traffic and the monitoring system reports an uptick in issues, teams can use feature flags to deactivate poorly performing features.
A great part of building and maintaining successful releases is to find out what works and what doesn’t. Experiments are a great way to learn about software, infrastructure, users, and systems. Some of these experiments include techniques such as A/B testing, game days, chaos experiments etc. This helps teams gather new information and innovate faster. Feature flags help developers test different aspects of a feature.
In software development, entitlement is the right to use services, products, or features that are often provided to a select group of users. Entitlements decide the features that each user can access and those that might be restricted to paid subscribers. Feature flags help organisations to manage and control entitlements. This helps in designing better customer experiences and operational efficiency.
Another benefit of feature flags is that they can be used to reduce complex code integration and deployment scenarios. New features and/or sensitive code refactoring can prove to be difficult to integrate into the main production branch, especially when multiple dev teams are working on overlapping parts of the code.
Feature flags help isolate new changes while maintaining the known, stable code. This helps eliminate long-running and multiple-feature branches. When the code is ready to be deployed, there is no need to disrupt with a massive merge; the team can simply toggle the feature flag and enable the new system.
Feature toggles or feature flags are a powerful technique that allows teams to modify system behaviour without impacting code. They have multiple use cases and benefits. Using feature flags allows for better control and more experimentation over feature management. From testing in production to deploying canary releases, to quicker release cycles to feature gating and roll-back or kill switch, feature flags have many use cases and are increasingly being used by agile and DevOps teams to learn fast and deploy continuously. Last but not least, feature flagging improves the CI/CD pipeline by making ‘continuous’ possible. With continuous delivery and relevant feature flag management, teams can launch, control and measure features at scale.