DEV Community

Cover image for How Feature Flags Enable Agile Decisions and Improve CI/CD
Andrew MacLean for DevCycleHQ

Posted on • Originally published at devcycle.com on

How Feature Flags Enable Agile Decisions and Improve CI/CD

Integrating feature flags with all of your code repositories, CI/CD, project planning, and monitoring can help you overcome the challenges that come with them.

Improving Continuous Integration/Continuous Deployment and Enabling Agile Decisions with Feature Flags 

A feature flag is a useful tool for development teams. It allows you to edit code on the fly by choosing between different code paths at runtime. While testing new features, businesses should start using feature flags since they are a valuable tool to validate and measure performance throughout the entire process. When it comes to DevOps, visibility is key. Integrating feature flags with all of your code repositories, CI/CD, project planning, and monitoring can help you overcome the challenges that come with them.

How Exactly Do Feature Flags Work?

A feature flag is a software development technique that provides the ability to turn certain features of a system on or off at any point in time. Using them is a best practice that allows team members to make changes to the production code without having to constantly branch and merge for each new iteration. This saves time and money, particularly on long-running projects.

Developers can use feature flags to release a small number of users and then roll back if they find bugs or glitches in the code. A feature can also be tested before it's completed and ready for release. Developers can use a technique called 'feature toggling' in order to release a version of a product that may still be in the development process. 

What are the Benefits?

There are several types of feature flags that all serve different purposes. Release toggles are a flag for incomplete or latent code that allows it to be deployed to production and activated in the future. Experiment toggles are short-lived toggles that are used for A/B testing. This toggle is only kept in place long enough to gather any insights. 

Ops toggles are a tool that system administrators can use to quickly switch between two different configurations. This is a great way to roll back from a poorly performing release, but it can also be used as a kill switch if admins decide to make a long-term change. Permission toggles allow you to turn on or off features for specific users based on their needs. For example, toggles can be used for "premium" features, alpha or beta features, or even internal features. Some companies use feature flags to control access for certain customers. For example, a company might only allow customers with an administrative position or customers with a premium account to access a specific feature.

Feature flags allow you to decouple deployment from a release. If you're launching a big new feature that requires several other teams to build and release changes you want to avoid having certain teams having to pause their work just because another team isn't done their changes are needed to move forward.

With feature flags teams can develop using a feature branch meaning they aren't dependent on other teams deploying to get their work done. Release toggles are an incredible way to avoid long-lived branches and decouple changes across different systems. This allows a team to avoid code rollouts and deploy on their own time. Release toggles are a powerful capability that offer a lot of benefits to teams.

When the feature is ready to be shown to users rather than releasing the new feature all at once, the team will expose it to just 5% of customers.  After enabling their new feature, the team monitors their system metrics for any problems. They watch error rates and response time for a while and see no noticeable changes. They'll monitor how well this small initial group of customers works, and if things go well, they'll gradually move on to a full release.

If something does go wrong, feature flags can be used as a kill switch to disable a feature quickly. This gives engineers peace of mind and allows them to react in a timely manner to any issues which could arise.

Feature flags are a handy way of testing out new features in production. This way, you get to see what your users experience without having to spend time testing in pre-production environments. The best part is that you can get through many of the problems of pre-production testing, such as test data, stability issues, version mismatches, or environmental drift.

Feature flags are useful at any phase of your product's life cycle. They can be used to safely manage large-scale architectural migrations by extracting a chunk of functionality out of a monolith and into a microservice. Branch by abstraction techniques can also be used when patching issues. For example, you might want to roll out a new design to fix an issue in the user interface. 

How Do Feature Flags Help Make Decisions?

Feature flags are incredibly useful for the decision-making process. They can be leveraged to give access to a new feature to only certain users. Let's say you want to run a beta test. With feature flags, you can have certain features only be available for beta users. From there you can gather feedback that will impact decisions surrounding how to continue developing your feature. With a beta test, you can also see the impact it has on your system so you can make adjustments accordingly.

When using feature flags for canary releases you can see how real users interact with your feature and decide to continue rolling it out or rolling it back to make updates. This gives developers the flexibility to make changes to a feature even if it's live without high levels of risk.

How Do Feature Flags Help with CI/CD?

Feature flags are an invaluable tool for continuous deployment pipelines. These tools allow developers to decouple deployment from release and also place control of features into the hands of product management. Feature flags also allow teams to practice trunk-based development, which speeds up the process by integrating changes very often.

Top comments (0)