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:
feature-flag-reference-validator: configcat/feature-flag-reference-validator@2.0.2
Use feature-flag-reference-validator
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Executes the reference validator job with default parameters.
1
2
3
4
5
6
7
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
workflows:
main:
jobs:
- configcat/validate-flag-references
Executes the reference validator job with verbose logging and fails the execution on validation warnings.
1
2
3
4
5
6
7
8
9
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
workflows:
main:
jobs:
- configcat/validate-flag-references:
debug: true
fail-on-warnings: true
Installs the ConfigCat validator and it's dependencies on the current environment. It uses `apt-get` and `pip` so it must be executed on an environment which has those.
1
2
3
4
5
6
7
8
9
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
jobs:
build:
docker:
- image: circleci/python:2.7
steps:
- configcat/install-validator
Installs the ConfigCat validator and executes the reference validation command with custom configuration on a python based docker environment.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
jobs:
build:
docker:
- image: circleci/python:2.7
steps:
- checkout:
path: /repo
- configcat/install-validator
- configcat/execute-validation:
debug: true
fail-on-warnings: true
scan-directory: /repo
Executes the reference validator in a job which uses the pre-configured configcat job executor.
1
2
3
4
5
6
7
8
9
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
jobs:
build:
executor: configcat/default
steps:
- checkout
- configcat/execute-validation
Scans the repository for ConfigCat feature flag references. Displays the missing feature flag keys in CircleCI's build log.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
configcat-sdk-key | The SDK Key of your ConfigCat project. | No | CONFIG_CAT_SDK_KEY | env_var_name |
configcat-cdn-server | The domain name of the ConfigCat CDN where you ConfigCat configuration file is stored. | No | cdn.configcat.com | string |
fail-on-warnings | Signals a build error in CircleCI when the validation fails. By default only warnings are showed. | No | false | boolean |
debug | Turns on detailed logging. | No | false | boolean |
Installs the ConfigCat flag reference validator tool and its dependencies.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
validator-version | The version of the ConfigCat flag reference validator pypi package. | No | 2.0.1 | string |
Installs the ConfigCat flag reference validator tool and its dependencies on windows.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
validator-version | The version of the ConfigCat flag reference validator pypi package. | No | 2.0.1 | string |
Scans the repository for ConfigCat feature flag references. Displays the missing feature flag keys in CircleCI's build log.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
configcat-sdk-key | The SDK Key of your ConfigCat project. | No | CONFIG_CAT_SDK_KEY | env_var_name |
scan-directory | The directory to scan for flag references. | No | . | string |
configcat-cdn-server | The domain name of the ConfigCat CDN where you ConfigCat configuration file is stored. | No | cdn.configcat.com | string |
fail-on-warnings | Signals a build error in CircleCI when the validation fails. By default only warnings are showed. | No | false | boolean |
debug | Turns on detailed logging. | No | false | boolean |
Scans the repository for ConfigCat feature flag references on windows. Displays the missing feature flag keys in CircleCI's build log.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
configcat-sdk-key | The SDK Key of your ConfigCat project. | No | CONFIG_CAT_SDK_KEY | env_var_name |
scan-directory | The directory to scan for flag references. | No | . | string |
configcat-cdn-server | The domain name of the ConfigCat CDN where you ConfigCat configuration file is stored. | No | cdn.configcat.com | string |
fail-on-warnings | Signals a build error in CircleCI when the validation fails. By default only warnings are showed. | No | false | boolean |
debug | Turns on detailed logging. | No | false | boolean |
The Docker container to use when executing the reference validator job.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
docker-image-version | The version of the ConfigCat flag reference validator docker image. | No | 2.0.1 | string |
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# 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 validate them against your feature flags on the ConfigCat Dashboard.
Manage features and change your software configuration using ConfigCat feature flags, without the need to re-deploy code. A 10 minute trainable dashboard allows even non-technical team members to manage application features. Supports A/B testing, soft launching or targeting a specific group of users first with new ideas. Deploy any time, release when confident. Open-source SDKs enable easy integration with any web, mobile or backend application.
display:
home_url: https://configcat.com
source_url: https://github.com/configcat/flag-reference-validator
examples:
job-default-configuration:
description: Executes the reference validator job with default parameters.
usage:
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
workflows:
main:
jobs:
- configcat/validate-flag-references
job-complex-configuration:
description: Executes the reference validator job with verbose logging and fails the execution on validation warnings.
usage:
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
workflows:
main:
jobs:
- configcat/validate-flag-references:
debug: true
fail-on-warnings: true
install-validator-command:
description: Installs the ConfigCat validator and it's dependencies on the current environment. It uses `apt-get` and `pip` so it must be executed on an environment which has those.
usage:
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
jobs:
build:
docker:
- image: circleci/python:2.7
steps:
- configcat/install-validator
execute-validation-command:
description: Installs the ConfigCat validator and executes the reference validation command with custom configuration on a python based docker environment.
usage:
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
jobs:
build:
docker:
- image: circleci/python:2.7
steps:
- checkout:
path: /repo
- configcat/install-validator
- configcat/execute-validation:
debug: true
fail-on-warnings: true
scan-directory: /repo
custom-executor:
description: Executes the reference validator in a job which uses the pre-configured configcat job executor.
usage:
version: 2.1
orbs:
configcat: configcat/feature-flag-reference-validator@2.0.1
jobs:
build:
executor: configcat/default
steps:
- checkout
- configcat/execute-validation
executors:
default:
description: The Docker container to use when executing the reference validator job.
parameters:
docker-image-version:
description: The version of the ConfigCat flag reference validator docker image.
type: string
default: 2.0.1
docker:
- image: configcat/feature-flag-reference-validator:<< parameters.docker-image-version >>
commands:
install-validator:
description: Installs the ConfigCat flag reference validator tool and its dependencies.
parameters:
validator-version:
description: The version of the ConfigCat flag reference validator pypi package.
type: string
default: 2.0.1
steps:
- run:
name: Install feature flag validator dependencies
command: sudo apt-get install silversearcher-ag
- run:
name: Install feature flag reference validator
command: sudo pip install configcat-flag-reference-validator==<< parameters.validator-version >>
install-validator-win:
description: Installs the ConfigCat flag reference validator tool and its dependencies on windows.
parameters:
validator-version:
description: The version of the ConfigCat flag reference validator pypi package.
type: string
default: 2.0.1
steps:
- run:
name: Install feature flag reference validator dependencies
shell: powershell.exe
command: |
choco install python --no-progress
choco install ag --no-progress
- run:
name: Install feature flag reference validator
shell: powershell.exe
command: pip install configcat-flag-reference-validator==<< parameters.validator-version >>
execute-validation:
description: Scans the repository for ConfigCat feature flag references. Displays the missing feature flag keys in CircleCI's build log.
parameters:
configcat-sdk-key:
description: The SDK Key of your ConfigCat project.
default: CONFIG_CAT_SDK_KEY
type: env_var_name
scan-directory:
description: The directory to scan for flag references.
type: string
default: .
configcat-cdn-server:
description: The domain name of the ConfigCat CDN where you ConfigCat configuration file is stored.
type: string
default: cdn.configcat.com
fail-on-warnings:
description: Signals a build error in CircleCI when the validation fails. By default only warnings are showed.
type: boolean
default: false
debug:
description: Turns on detailed logging.
type: boolean
default: false
steps:
- run:
name: Scanning code for unused feature flags
command: |
if [[ -z "${<< parameters.configcat-sdk-key >>}" ]]; then
echo "Please, set the environment variable: '<< parameters.configcat-sdk-key >>'. Will stop now."
exit 1
fi
configcat-validator.py ${<< parameters.configcat-sdk-key >>} << parameters.scan-directory >> -s="<< parameters.configcat-cdn-server >>" -v=<< parameters.debug >> -f=<< parameters.fail-on-warnings >>
execute-validation-win:
description: Scans the repository for ConfigCat feature flag references on windows. Displays the missing feature flag keys in CircleCI's build log.
parameters:
configcat-sdk-key:
description: The SDK Key of your ConfigCat project.
default: CONFIG_CAT_SDK_KEY
type: env_var_name
scan-directory:
description: The directory to scan for flag references.
type: string
default: .
configcat-cdn-server:
description: The domain name of the ConfigCat CDN where you ConfigCat configuration file is stored.
type: string
default: cdn.configcat.com
fail-on-warnings:
description: Signals a build error in CircleCI when the validation fails. By default only warnings are showed.
type: boolean
default: false
debug:
description: Turns on detailed logging.
type: boolean
default: false
steps:
- run:
name: Scanning code for unused feature flags
shell: powershell.exe
command: |
if (-not (Test-Path env:<< parameters.configcat-sdk-key >>)) {
Write-Host "Please, set the environment variable: '<< parameters.configcat-sdk-key >>'. Will stop now."
exit 1
}
configcat-validator.py $env:<< parameters.configcat-sdk-key >> << parameters.scan-directory >> -s="<< parameters.configcat-cdn-server >>" -v=<< parameters.debug >> -f=<< parameters.fail-on-warnings >>
jobs:
validate-flag-references:
description: Scans the repository for ConfigCat feature flag references. Displays the missing feature flag keys in CircleCI's build log.
parameters:
configcat-sdk-key:
description: The SDK Key of your ConfigCat project.
default: CONFIG_CAT_SDK_KEY
type: env_var_name
configcat-cdn-server:
description: The domain name of the ConfigCat CDN where you ConfigCat configuration file is stored.
type: string
default: cdn.configcat.com
fail-on-warnings:
description: Signals a build error in CircleCI when the validation fails. By default only warnings are showed.
type: boolean
default: false
debug:
description: Turns on detailed logging.
type: boolean
default: false
executor:
name: default
working_directory: /ref-validator
steps:
- checkout:
path: /ref-validator/repo
- execute-validation:
configcat-sdk-key: << parameters.configcat-sdk-key >>
configcat-cdn-server: << parameters.configcat-cdn-server >>
fail-on-warnings: << parameters.fail-on-warnings >>
debug: << parameters.debug >>
scan-directory: ./repo