Continuous Feature Delivery: Managing Deployments With Feature Flags

8 min read

The following is a guest blog post written by Michiel Mulders.

How feature flags support continuous feature delivery

Continuous feature delivery tries to provide an alternative way of delivering new features to users faster while providing high-quality software.

In this post, we’ll learn how feature flags support different release types and what benefits continuous feature delivery brings. Before we start, let’s make sure you have a comprehensive understanding of feature flags.

What Are Feature Flags?

Hey, this article talks about continuous feature delivery and managing deployments with feature flags. Perhaps you don’t fully grasp the concept of feature flags. So what are feature flags exactly?

A feature flag, also referred to as a feature toggle, describes itself as a way to enable or disable features in a live production system. This means you have on-the-fly control over the activated features in your live software product. The use of feature flags is a very powerful technique that allows for the modification of an active system's behavior. That’s cool, right?

But wait, there’s more! Feature flags enable many different use cases.

Overview of the most common Feature Flag use cases:

  • Basic use case: Isolate logic or a feature with a simple if statement to be enabled or disabled. Here’s an example of what this might look like:

```jsif (feature.CREATE_INVOICE === true) {

  // enabled -> activate feature 'CREATE_INVOICE'

  do ...

}

```

  • Kill switch: Enable or disable a feature in a live production system via a remote call such as an API call. Acts as a backup plan in case something goes wrong or a critical bug is found in a feature.

  • A/B testing: Feature flags allow for a feature to be rolled out to a small portion of your user base so you can evaluate how users interact with a new feature. Based on the user behavior, you can decide if the feature is ready to be permanently merged into your live production system.

Next, let’s dive deeper into feature flags and how they enable continuous feature delivery.

What Is Continuous Feature Delivery?

Continuous feature delivery focuses on decoupling code deployments from releases. A new feature doesn’t necessarily have to be released via a code release. Feature flags take continuous delivery (CD) to the next level as they allow new features to be delivered continuously without creating a new release.

As feature flags allow developers to merge features that aren’t finished yet to the production branch, they also support continuous feature delivery. Whenever a new feature has been completed, the responsible developer can toggle on the feature flag for its completed feature.

This way, your team can move away from the slower concept of releases and move to a faster rollout of features using continuous feature delivery.

Furthermore, continuous feature delivery helps with avoiding merge conflicts. Assume 2 pull requests (PRs) are ready to be merged but turn out to be conflicting. Actually, you wanted to create a release, but now you’ll have to rewrite one of your PRs. This slows down your release process and the overall efficiency of your team.

When using feature flags, developers can directly merge code to the production system and get feedback about possible conflicts without enabling this feature. This also means that other developers can explore the code you’ve added and possibly build on top of this code, avoiding any conflicts.

Why Should You Use Feature Flags?

Feature flags are more than just a toggle; it’s a new movement like DevOps that tries to change the way we perceive software deployment or continuous delivery. Traditionally, DevOps is focused on deploying completed features, whereas feature flags focus on merging code as soon as possible while managing risks by disabling a feature through a feature flag.

Feature flags give teams fine-grained control over the features they expose to users.

Further, feature flags support the concept of a dark launch. A dark launch releases a feature to a select group of users so they can try out this new feature and provide valuable feedback. It’s a great way for testing the success of a new feature while still managing risks within a small subset of your user base.

A dark launch is one of the most common use cases for feature flags. The next section explores different examples of how you gain fine-grained control over feature rollout through feature flag management.

Continuous Feature Delivery using Fine-Grained Feature Flag Management 

Let’s explore different feature flag management examples.

#1. Selective CloudBees Feature Management

As discussed before, feature flags support a selective rollout of new features. For example, a dark launch exposes a new feature to a select group of early testers to provide you with feedback about the feature.

However, you can also use a selective rollout for enabling certain features for premium users or beta users. Many products offer paid features that can only be accessed by the users that pay for the premium functionality. Instead of developing your in-house plugin for managing premium features, you can use feature flag management solutions such as the CloudBees Feature Management solution. They provide ready-made plugins and code snippets via their SDK to quickly implement different types of feature flag use cases.

#2. Geographical Feature Flags

Secondly, you can use feature flags to roll out features for only specific geographic regions or countries. Imagine you own a financial product that isn’t authorized to operate in certain countries. To comply with local regulations, you need to disable certain features for users in a specific country or region. Again, feature flags can help you accomplish geographical rollout.

#3. Roll-out faster to paid users

The concept of rolling out new features faster to paid users isn’t that common. However, it’s similar to how Patreon works. Patreon allows creators to receive contributions for the content they create. In return, contributors can access new content earlier than non-contributors. The concept of rolling out new features faster to paying users works for certain use cases such as content creation.

#4. Advanced Feature Flag activation

Let’s get to the fun stuff. What if you want to enable feature X on your staging environment so your product manager can test the feature but disable the feature for your production environment.

CloudBees Feature Management supports these feature flag configurations natively. You can create custom configurations based on specific branches or other configuration items that determine the activation or deactivation of features.

#5. Percentage rolling releases based on user feedback

Lastly, let’s explore a complex use case where we roll out a new feature gradually to a bigger percentage of our user base until we have released the feature to all users. For example, every day, we release a new feature to 5% of the user base.

While rolling out the feature, you collect quantitative user feedback. For example, you can ask users to rate the feature on a scale of 1 to 10. Next, you implement a snippet of logic that reverts a new feature if 30% of the users report a score below 5/10. Of course, you can play with the numbers.

This is an excellent example of how you can combine quantitative user feedback and percentage rolling releases in an automated way.

Better Control Over Software Deployments

Within a “traditional” DevOps setup, your team creates a release that you need to merge to the production branch. Further, your team has to engage in QA testing, which is a slow process where you’ll often find nasty bugs that slow down your team.

By using feature flags, you can decouple releases from deployments. Decoupling releases and deployments helps to increase developer productivity by taking them out of the business decision of releases and allowing them to already be working on the next feature.

Also, a feature flag supports a dark launch of a new feature so a selective group of users can test the new feature. In other words, feature flags could potentially remove the need for QA testing entirely in some situations as you could leverage your user base for QA testing.

Conclusion

Don’t let a buggy or unfinished feature stop you from progressing or rolling out new features to your users. Continuous feature delivery is the answer to increasing developer and company productivity. As a company, you can roll out and develop new features faster, gaining an edge over your competitors.

Want to learn more about CloudBees Feature Management? Check out their feature flag offering.

Michiel Mulders is a passionate blockchain developer who loves writing technical content. Besides that, he loves learning about marketing, UX psychology, and entrepreneurship. When he's not writing, he's probably enjoying a Belgian beer!

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.