Create/manage flags in the UI

3 minute read

Feature flags enable software development teams to progressively toggle features on and off for certain segments of users. Flags are defined as boolean, number, or string type. Create flags in either the UI or in your code.

Flag settings

Flag names are case-sensitive, and must exactly match in both the source code and the platform UI to be the same flag. The flag name and the flag data type are required settings and not editable.

Table 1. Flag settings apply to a flag in all environments.
Flag setting Definition Required? Editable?

Name

The flag name.

Description

Any descriptive information about the flag.

Type

The flag type: Boolean, string, or number.

Variation (string or number flags only)

One or more possible predefined flag values. Each value must be the appropriate type. For example, the string value test is a variation for a string flag, and 234 is a variation for a number flag.

Label

A way of organizing flags. For example, tag all flags administered by a specific developer team with the same label.

Access and display flags

Display the flag list for an environment in an organization or sub-organization, the top-level resource in feature management.

To display the flag list for an environment:

  1. Select Feature management from the left pane.

  2. Select an Environment from the options.

    Flags in an environment
    Figure 1. Flag environment highlighted.
    Flag configurations are environment-dependent. For more information, refer to Learn about feature flags.
  3. (Optional) Choose from the following filter, search, and sort options:

    1. Filter flags according to multiple criteria.

    2. Search for flags by entering all or part of a flag name into Search.

    3. Select Sort icon or Sort icon next to a heading to sort ascending or descending, respectively, on that heading.

The flags are displayed according to the search or sort criteria.

Flag list
Figure 2. Flag filter(A), search(B), and sort(C) options highlighted.

Filter flag lists

Filter flags in an environment according to the following criteria:

  • Configuration

  • Flag type

  • Label

  • Namespace

To filter flags:

  1. Select FILTER.

  2. Filter one or more of the following ways:

    • Select Configuration, and then select an On or Off status.

    • Select Flag type, and then select one or more options.

    • Select Label, and then select one or more options.

    • Select Namespace, and then select one or more options.

The flags are displayed according to the filtering criteria.

Flag list
Figure 3. Status, flag type, and namespace filter, with FILTER highlighted.

Create a flag in the UI

A created flag is available across all environments of the top-level resource (the organization or sub-organization) in which it is created.

Once you create a flag, you cannot edit its name or its data type.

To create a flag:

  1. Select Feature management from the left pane.

  2. Select CREATE FLAG.

  3. Enter a flag Name.

  4. (Optional) Enter a Description.

  5. Select a Type from the options.

  6. (Optional, for string and number flags only) Define variations, as follows:

    1. Select Define variations.

    2. Select ADD VARIATION.

    3. Enter a value of the appropriate data type for your flag.

    4. (Optional) Select ADD VARIATION to enter another value.

      You may enter unlimited variations.

      Create flag variations
      Figure 4. Creating a flag, with variations highlighted.
  7. (Optional) Enter any Labels.

  8. Select SAVE.

Your flag is created, and listed in Feature management. Enable the flag configuration by turning the configuration status to On.

Create a flag in code

Create a flag in your source code and run your application. Your newly created flag is displayed in the platform feature management flag list. Refer to Create flags in code to learn more.

Update an optional flag setting

Add to, remove, or edit any optional flag setting.

To update optional flag settings:

  1. Select Feature management from the left pane.

  2. Select the next to the flag you want to edit.

  3. Select Edit.

  4. Update the Description, any variations, or any Labels.

    • Select the next to a variation to remove it, or delete all variations at once by selecting Define variations.

    • Remove a label from a flag by selecting the "X" next to the label name.

  5. Select UPDATE.

The optional flag setting(s) is updated accordingly.

Delete a flag

To delete a feature flag, you must first turn off its configuration in all environments. A deleted flag is completely removed from the CloudBees platform, including all environments, and deletion is irreversible.

To delete a flag:

  1. Select Feature management from the left pane.

  2. Select the next to the flag you want to delete.

  3. Select Delete.

  4. Select the toggle next to the flag to disable the flag configuration for all environments.

    Turn off flag to delete
    Figure 5. Selecting the highlighted toggle disables a flag configuration.
  5. Select DELETE.

The selected flag is deleted and removed from the flag list.