Deleting feature flags

5 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, contact support@cloudbees.com and provide the following information:

  • Flag name

  • Flag type

  • Flag variations

You must be an administrator with 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.

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) Targeting must be off for all environments before the Delete flag button is enabled, and a flag can be safely deleted.

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

  • (Recommended) All Jira tasks are completed.

  • (Recommended) All GitHub code references are removed.

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.

Flags configurations are not automatically removed from the code when a flag is deleted. Refer to Integrating with Jira for information on how to create code removal tasks.

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, in the left pane, select the environment.

  2. From the center of your screen, select Show cleanup candidates.

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

To clear the Show cleanup candidates filter:

  1. Select the X next to the filter, or next to Clear all, to clear it.

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 Cleanup.

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

    If the flag has targeting turned on, a warning is displayed: This flag cannot be deleted until all required blocking issues are resolved.

  3. Turn the flag targeting to OFF in the Targeting column for each environment.

    When targeting is off for all environments, the Delete flag button is enabled. However, CloudBees recommends that you complete all tasks before deleting a flag.
  4. The Resolve any Jira issues linked to your flag section lists any tasks that are assigned to the flag using the Jira integration. Select a Jira task to resolve it in Jira.

    To integrate with Jira, select the go to the App Settings page and add a Jira API key link. Refer to Integrating with Jira to learn more.
  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. Refer to Integrating CloudBees Feature Management with GitHub for flag cleanup for more information.

Adding a Jira cleanup task to a flag

To ensure that you have removed all flag references from the code, you can optionally add existing Jira issues to the list of cleanup tasks.

The issue must exist in Jira before it can be added to a flag.

To add a Jira cleanup task:

  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. In Have all flag cleanup tasks been completed?, select Add Jira issue.

    Adding a Jira issue
    Figure 4. Adding a Jira issue to the cleanup task list
  5. Enter the exact issue key or summary subtext into the search.

  6. Place a check next to one or more tickets, and select Add selected.

The Jira issue is listed as a task to complete.

Completing a Jira cleanup task

When the Jira issue is closed or marked as complete from within the Jira UI, it is marked as complete in CloudBees Feature Management with a strikethrough the issue number and issue name.

A completed Jira issue with a strikethrough the task and title
Figure 5. The Jira cleanup task is completed

Removing a Jira cleanup task from a flag

You can remove Jira issues from any flag regardless of completion status.

To remove a Jira issue from the flag cleanup task list:

  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. In Have all flag cleanup tasks been completed?, select the Remove cleanup task trashcan icon next to the Jira issue.

    The cleanup icon
    Figure 6. Removing a Jira issue

    The Remove cleanup task dialog lists the issue name.

  5. If you are sure that you want to remove this cleanup task, place a check next to Yes, I understand and accept the risks associated with this action.

    A checkmark is placed in the Remove cleanup task dialog
    Figure 7. Removing a cleanup task
  6. Select Yes, Remove.

The cleanup task is removed from the flag.

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 Yes, I understand and accept the risks associated with this action.

  6. Select Delete.

The flag is deleted, and removed from all environments.