Skip to main content
Version: Config V1

Bitbucket Pipe - Scan your code for unused feature flags

ConfigCat's Bitbucket Pipe has the ability to scan your source code for feature flag and setting usages and upload the found code references to ConfigCat.

This feature makes the elimination of the technical debt easier, as it can show which repositories reference your feature flags and settings in one centralized place on your Dashboard.

Here you can find more details about how this feature works.

This section describes how to use ConfigCat's Bitbucket Pipe to automatically scan your source code for feature flag and setting usages and upload the found code references to ConfigCat. You can find more information about Bitbucket Pipelines here.

Setup

  1. Create a new ConfigCat Management API credential and store its values in secure pipeline variables with the following names: CONFIGCAT_API_USER, CONFIGCAT_API_PASS.

    Bitbucket Pipe secrets
  2. Get your selected Config's ID.

  3. Add the following snippet to the script section of your bitbucket-pipelines.yml file. Don't forget to replace the PASTE-YOUR-CONFIG-ID-HERE value with your actual Config ID.

    - pipe: configcat/scan-repository-pipe:1.4.4
    variables:
    CONFIG_ID: 'PASTE-YOUR-CONFIG-ID-HERE'
    # LINE_COUNT: '3' # optional
    # SUB_FOLDER: '/src' # optional
    # EXCLUDE_KEYS: > # optional
    # flag_key_to_exclue_1
    # flag_key_to_exclue_2
    # VERBOSE: 'true' # optional
  4. Commit & push your changes.

Scan reports are uploaded for each branch of your repository that triggers the job.

Available Options

ParameterDescriptionRequiredDefault
CONFIG_ID ID of the ConfigCat config to scan against.
CONFIGCAT_API_HOSTConfigCat Management API host.api.configcat.com
LINE_COUNTContext line count before and after the reference line. (min: 1, max: 10)4
SUB_FOLDERSub-folder to scan, relative to the repository root folder.
EXCLUDE_KEYSList of feature flag keys that must be excluded from the scan report.
VERBOSETurns on detailed logging.false