1. configcat/scan-repository@1.10.1

configcat/scan-repository@1.10.1

Partner
Sections
This Orb's responsibility is to discover ConfigCat feature flag usages in your source code and to upload them to ConfigCat.
Created: October 20, 2021Version Published: July 26, 2024Releases: 15
Org Usage:
< 25

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: scan-repository: configcat/scan-repository@1.10.1

Use scan-repository elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Usage Examples

complex

Executes the scan job with custom parameters.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 version: '2.1' orbs: configcat: configcat/scan-repository@1.10.1 workflows: main: jobs: - configcat/scan: alias-patterns: (\w+) = :CC_KEY,const (\w+) = feature_flags\.enabled\(:CC_KEY\) commit-url-template: https://github.com/my/repo/commit/{commitHash} config-id: PASTE-YOUR-CONFIG-ID-HERE exclude-keys: | flag_key_to_exclue_1 flag_key_to_exclue_2 file-url-template: >- https://github.com/my/repo/blob/{commitHash}/{filePath}#L{lineNumber} line-count: 3 sub-folder: src usage-patterns: feature_flags\.enabled\(:CC_KEY\) verbose: true

simple

Executes the scan job with default parameters.

1 2 3 4 5 6 7 8 version: '2.1' orbs: configcat: configcat/scan-repository@1.10.1 workflows: main: jobs: - configcat/scan: config-id: PASTE-YOUR-CONFIG-ID-HERE

Jobs

scan

Find code references to ConfigCat feature flags or settings in your source code.

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
alias-patterns
Comma delimited list of custom regex patterns used to search for additional aliases.
No
''
string
api-host
ConfigCat Management API host.
No
api.configcat.com
string
api-pass
ConfigCat Management API basic authentication password.
No
CONFIGCAT_API_PASS
env_var_name
api-user
ConfigCat Management API basic authentication username.
No
CONFIGCAT_API_USER
env_var_name
commit-url-template
Template url used to generate VCS commit links. Available template parameters: commitHash. Example: https://github.com/my/repo/commit/{commitHash}
No
''
string
config-id
ID of the ConfigCat config to scan against.
Yes
-
string
exclude-keys
List of feature flag keys that must be excluded from the scan report.
No
''
string
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}
No
''
string
line-count
Context line count before and after the reference line (min: 1, max: 10)
No
4
integer
sub-folder
Sub-folder to scan, relative to the repository root folder.
No
''
string
usage-patterns
Comma delimited list of custom regex patterns that describe additional feature flag key usages.
No
''
string
verbose
Turns on detailed logging.
No
false
boolean

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | This Orb's responsibility is to discover ConfigCat feature flag usages in your source code and to upload them to ConfigCat. display: home_url: https://configcat.com source_url: https://github.com/configcat/scan-repository-orb jobs: scan: description: | Find code references to ConfigCat feature flags or settings in your source code. docker: - image: configcat/cli:2.3.2 parameters: alias-patterns: default: "" description: Comma delimited list of custom regex patterns used to search for additional aliases. type: string api-host: default: api.configcat.com description: ConfigCat Management API host. type: string api-pass: default: CONFIGCAT_API_PASS description: ConfigCat Management API basic authentication password. type: env_var_name api-user: default: CONFIGCAT_API_USER description: ConfigCat Management API basic authentication username. type: env_var_name commit-url-template: default: "" description: 'Template url used to generate VCS commit links. Available template parameters: commitHash. Example: https://github.com/my/repo/commit/{commitHash}' type: string config-id: description: ID of the ConfigCat config to scan against. type: string exclude-keys: default: "" description: List of feature flag keys that must be excluded from the scan report. type: string file-url-template: default: "" description: '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}' type: string line-count: default: 4 description: 'Context line count before and after the reference line (min: 1, max: 10)' type: integer sub-folder: default: "" description: Sub-folder to scan, relative to the repository root folder. type: string usage-patterns: default: "" description: Comma delimited list of custom regex patterns that describe additional feature flag key usages. type: string verbose: default: false description: Turns on detailed logging. type: boolean steps: - checkout: path: /repo - run: command: | apk add openssh-client if [[ -z "${<< parameters.api-user >>}" ]]; then echo "Please, set the environment variable: '<< parameters.api-user >>'. Will stop now." exit 1 fi if [[ -z "${<< parameters.api-pass >>}" ]]; then echo "Please, set the environment variable: '<< parameters.api-pass >>'. Will stop now." exit 1 fi EXCLUDE_KEYS="' '" [ ! -z "${SCAN_EXCLUDE_KEYS}" ] && EXCLUDE_KEYS=${SCAN_EXCLUDE_KEYS} configcat scan "/repo/<< parameters.sub-folder >>" \ --config-id=<< parameters.config-id >> \ --repo=${CIRCLE_PROJECT_REPONAME} \ --line-count=<< parameters.line-count >> \ --file-url-template="<< parameters.file-url-template >>" \ --commit-url-template="<< parameters.commit-url-template >>" \ --runner="ConfigCat CircleCI Orb v1.10.1" \ --upload \ --verbose=<< parameters.verbose >> \ --non-interactive \ --exclude-flag-keys ${EXCLUDE_KEYS} environment: CONFIGCAT_ALIAS_PATTERNS: << parameters.alias-patterns >> CONFIGCAT_API_HOST: << parameters.api-host >> CONFIGCAT_USAGE_PATTERNS: << parameters.usage-patterns >> SCAN_EXCLUDE_KEYS: << parameters.exclude-keys >> name: Scanning repository for references examples: complex: description: | Executes the scan job with custom parameters. usage: version: "2.1" orbs: configcat: configcat/scan-repository@1.10.1 workflows: main: jobs: - configcat/scan: alias-patterns: (\w+) = :CC_KEY,const (\w+) = feature_flags\.enabled\(:CC_KEY\) commit-url-template: https://github.com/my/repo/commit/{commitHash} config-id: PASTE-YOUR-CONFIG-ID-HERE exclude-keys: | flag_key_to_exclue_1 flag_key_to_exclue_2 file-url-template: https://github.com/my/repo/blob/{commitHash}/{filePath}#L{lineNumber} line-count: 3 sub-folder: src usage-patterns: feature_flags\.enabled\(:CC_KEY\) verbose: true simple: description: | Executes the scan job with default parameters. usage: version: "2.1" orbs: configcat: configcat/scan-repository@1.10.1 workflows: main: jobs: - configcat/scan: config-id: PASTE-YOUR-CONFIG-ID-HERE
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.