Deleting feature flags

4 minute read

If a flag is deleted, it cannot be restored, and the name cannot be reused without help from CloudBees Support.

To recover a flag or reuse a flag name, submit a product request to CloudBees Support and provide the following information:

  • Flag name

  • Flag type

  • Flag variations

You must have full access to all environments to delete a flag.

Feature flags that are no longer used in any environment can be safely deleted using the Cleanup screen.

Flag cleanup helps you determine when it is safe to delete your unused and outdated flags for features that have been fully deployed, by recommending cleanup tasks and quick access links to task locations. Hidden flags can also be deleted.

Removing unused feature flags helps maintain cleaner code and reduce technical debt.

You can optionally integrate with Jira and configure additional cleanup tasks. Refer to Integrating with Jira for more information.

A flag is safe to delete when the following is achieved:

  • (Required) Configuration must be OFF for all environments before the Delete flag button is enabled and a flag can be safely deleted.

  • (Required) All flag dependencies must be removed, so deletion of the flag does not affect any other flag.

  • (Recommended) Flag status is inactive. A flag becomes inactive when no impressions have been received in the past seven days.

  • (Recommended) All GitHub code references are removed.

  • (Recommended) All connected Jira issues are completed.

When a flag is deleted:

  • The action cannot be undone.

  • It is removed from the list of existing flags.

  • It is deleted from all environments.

  • If the flag is still in the code, it serves its default value.

  • The latest flag configuration and impression data is lost.

  • The name cannot be reused.

Flag configurations are not automatically removed from the code when a flag is deleted.

You can also hide a flag in an environment instead of deleting it. A hidden flag still works and is accessible to users.

Filtering stale and inactive flags

You can filter stale and inactive flags, known as cleanup candidates, within any environment. The number of candidates per total flags is listed next to the filter.

To filter cleanup candidates:

  1. From the CloudBees Feature Management Home page, select Flags in environments, and then select an environment.

  2. Select Show cleanup candidates.

The flag list is filtered for Stale or Inactive status and the cleanup candidates are displayed.

To clear the Show cleanup candidates filter:

  1. Select either Clear all or the X next to the 2 statuses filter.

The flag list is no longer filtered for cleanup candidates.

Selecting cleanup candidates and clear filter
Figure 1. Selecting the Show cleanup candidates filter and methods of clearing the filter

You can sort each column in the cleanup candidate list by selecting the column heading. If a cleanup candidate flag is hidden in an environment, it is listed in the Hidden flags tab.

Performing flag cleanup tasks

Before a flag is deleted, CloudBees recommends that you complete all flag cleanup tasks.

To perform flag cleanup tasks:

  1. From the CloudBees Feature Management Home page, select Flags in environments, and then select an environment.

  2. Do one of the following to access the cleanup tasks:

    • Select the trash can icon to the right of the flag you want to delete.

      Accessing Cleanup from the environment
      Figure 2. Accessing Cleanup from the environment
    • Select the flag you want to delete, and then select Clean up Clean up.

      Accessing Cleanup from the flag
      Figure 3. Accessing Cleanup from the flag

    For your selected cleanup candidate flag, a cleanup table is displayed. You can sort each column in the cleanup table by selecting the column heading. If a flag is hidden in an environment, (Hidden) is displayed next to the environment name.

  3. A warning that the flag cannot be deleted is displayed if in any environment the cleanup candidate flag configuration is set to ON. Turn the configuration to OFF in the Configuration column for each environment.

    The flag cleanup table displaying a warning when configuration is **ON**
    Figure 4. The flag cleanup table displaying a warning when configuration is ON
  4. The Remove flag dependencies section lists any flags that would be affected if the cleanup candidate flag were deleted. If any feature flags depend on the cleanup candidate, the cleanup candidate cannot be deleted. Select each flag name in the list and remove the dependencies. Refer to Flag dependencies for more information.

    When configuration is off for all environments, and no flag dependencies exist, the Delete flag button is enabled. However, CloudBees recommends that you complete all tasks before deleting a flag, including removal of any GitHub code references, and completion of any connected Jira issues.
  5. In the Review any GitHub code references to your flag section, select View on GitHub to view search results for any code references to your flag in GitHub, and then make any necessary changes to your code.

    To connect with GitHub to search for code references, select go to the App Settings page and connect Code search: GitHub. To learn more, refer to Integrating CloudBees Feature Management with GitHub for flag cleanup.
  6. Complete any connected Jira issues. Refer to Managing flags with Jira for more information.

Deleting a flag

When all recommended cleanup tasks are complete, it is safe to delete the flag.

To delete the flag:

  1. From the CloudBees Feature Management Home page, in the left pane, select the environment.

  2. Select the flag you would like to delete.

  3. From the top right corner of your screen, select Cleanup.

  4. Select Delete flag.

    A Delete flag warning is displayed.

  5. Review the warning text. If you agree, select I understand the risks of deleting this flag.

  6. Select Delete.

The flag is deleted, and removed from all environments.