This CircleCI Orb is a utility that discovers ConfigCat feature flag & setting usages in your source code and uploads the found code references to ConfigCat.
For more information about repository scanning, see our documentation.
-
Create a new ConfigCat Management API credential and save its values in CircleCI Environment Variables with the following names:
CONFIGCAT_API_USER
,CONFIGCAT_API_PASS
. -
Get the ID of your ConfigCat Config that you want to associate with your repository. The scanner will use this ID to determine which feature flags & settings to search for in your source code.
-
Create a new CircleCI YAML config in your GitHub repository under the
.circleci
folder, and put the following snippet into it. Don't forget to replace thePASTE-YOUR-CONFIG-ID-HERE
value with your actual Config ID.version: 2.1 orbs: configcat: configcat/scan-repository@1.10.1 workflows: main: jobs: - configcat/scan: config-id: PASTE-YOUR-CONFIG-ID-HERE # required file-url-template: 'https://github.com/your/repo/blob/{commitHash}/{filePath}#L{lineNumber}' # optional commit-url-template: 'https://github.com/your/repo/commit/{commitHash}' # optional # line-count: 3 # optional # sub-folder: 'src' # optional # exclude-keys: > # optional # flag_key_to_exclue_1 # flag_key_to_exclue_2 # alias-patterns: (\w+) = :CC_KEY,const (\w+) = feature_flags\.enabled\(:CC_KEY\) # optional # usage-patterns: feature_flags\.enabled\(:CC_KEY\) # optional # verbose: true # optional
-
Commit & push your changes.
The above example configures a workflow that executes the scan and code references upload on every git push
event.
Scan reports are uploaded for each branch of your repository that triggers the workflow.
Parameter | Description | Required | Default |
---|---|---|---|
api-host |
ConfigCat Management API host. | ☑ | api.configcat.com |
api-user |
Name of the environment variable where the ConfigCat Management API basic authentication username is stored. | ☑ | CONFIGCAT_API_USER |
api-pass |
Name of the environment variable where the ConfigCat Management API basic authentication password is stored. | ☑ | CONFIGCAT_API_PASS |
config-id |
ID of the ConfigCat config to scan against. | ☑ | |
file-url-template |
Template url used to generate VCS file links. Available template parameters: commitHash , filePath , lineNumber . Example: https://github.com/my/repo/blob/{commitHash}/{filePath}#L{lineNumber} |
||
commit-url-template |
Template url used to generate VCS commit links. Available template parameters: commitHash . Example: https://github.com/my/repo/commit/{commitHash} |
||
line-count |
Context line count before and after the reference line. (min: 1, max: 10) | 4 | |
sub-folder |
Sub-folder to scan, relative to the repository root folder. | ||
exclude-keys |
List of feature flag keys that must be excluded from the scan report. | ||
alias-patterns |
Comma delimited list of custom regex patterns used to search for additional aliases. | ||
usage-patterns |
Comma delimited list of custom regex patterns that describe additional feature flag key usages. | ||
verbose |
Turns on detailed logging. | false |