Creating feature flags

2 minute read

Feature flags are the foundation of the CloudBees Feature Management platform and can encompass many types of logic and code.

Before creating a feature flag, refer to About feature flags to learn about how feature flags work.

Flag creation introduction

Creating feature flags in the UI and source code.

Watch the video
  • Flags can be created either in the CloudBees Feature Management UI, or by adding feature flag code to your application. If you add feature flag code to your application, compile and run it to view your feature flags in the CloudBees Feature Management dashboard.

  • The flag name, which is case-sensitive, must exactly match in both the source code and the CloudBees Feature Management UI for it to be the same flag.

  • Once created, a flag is available in all environments.

  • Once created, neither the flag name nor the flag type can be changed.

You can create three types of flags in the UI. For more information on each type, refer to:

When creating string and number flags, you can set predefined variation values. This is useful for values which cannot be predetermined, such as a timeout value or URL. To learn more, refer to Defining feature flag variations.

A flag can have an optional description, and any number of labels, if desired. If you add or create a label for a flag as it is being created, the labels are added to the flag in all environments. Refer to Working with labels for more information.

To ignore impression data, you can set a flag’s status to permanent. To learn more, refer to Flag status.

After creation, you can modify a flag’s description, labels, variations, or permanent status for a particular environment by going to the Settings screen for the flag in that environment. Learn more at Feature flag settings.

Creating a flag in the UI

A flag created in the CloudBees Feature Management UI is available in all environments.

To create a flag in the UI:

  1. From the CloudBees Feature Management Home page, select either the Overview screen or any environment under Flags in Environments.

  2. Select Create flag on the upper-right of the screen.

  3. Enter your flag name. If you use the format <namespace>.<flagname>, you can filter flags by <namespace>.

  4. Optionally, enter a description.

  5. Optionally, enter any labels from the options, or create a new one.

  6. Select a flag type from the options.

  7. For string or number types only, you can optionally add any number of variations:

    1. Select Variation editing off. Upon selection, Variation editing on is displayed, and Add variation is enabled.

    2. Select Add variation.

    3. Enter a variation value.

  8. Optionally, select Permanent flag to set the flag to Permanent status and ignore impression data.

  9. Select Create.

Your new flag is created in all environments. You can update the flag description, labels, variations, or permanent status on the Settings screen for a specific environment.

Create a new flag
Figure 1. Creating a new number flag in the UI, with a label and a variation value