Skip to content

Commit 1e1bdbc

Browse files
genesorp-datadogvpellan
authored andcommitted
[APMAPI-1474] ci: add config inversion CI steps (#4886)
Co-authored-by: Oleg Pudeyev <[email protected]> Co-authored-by: Victor Pellan <[email protected]>
1 parent 9a85e8a commit 1e1bdbc

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

.gitlab-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,18 @@ vaccine:
190190
after_script:
191191
# Revoke the token after usage
192192
- dd-octo-sts revoke -t $(cat token.txt)
193+
194+
# Config inversion CI steps
195+
validate_supported_configurations_local_file:
196+
rules:
197+
- when: on_success
198+
extends: .validate_supported_configurations_local_file
199+
variables:
200+
LOCAL_JSON_PATH: "supported-configurations.json"
201+
202+
update_central_configurations_version_range:
203+
extends: .update_central_configurations_version_range
204+
variables:
205+
LOCAL_JSON_PATH: "supported-configurations.json"
206+
LANGUAGE_NAME: "ruby"
207+
MULTIPLE_RELEASE_LINES: "false"

.gitlab/one-pipeline.locked.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# DO NOT EDIT THIS FILE MANUALLY
22
# This file is auto-generated by automation.
33
include:
4-
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/d44e89797a5a47c43cf712193abefe2178a004176606f7e01b77d1ec49a3ef5e/one-pipeline.yml
4+
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/bc1184decb7b0dedcce721eb08819b3bd8a36c0473e832b3ec1b804c8f1b5807/one-pipeline.yml

docs/AccessEnvironmentVariables.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ The configuration inversion system works as follows:
6363

6464
To add support for a new environment variable:
6565

66-
### Step 1: Add to supported-configurations.json
66+
### Step 1: Add to supported-configurations.json & central registry
67+
68+
If the configuration key has never been registered by any tracer it needs to be added to the [Configuration Registry](https://feature-parity.us1.prod.dog/#/configurations?viewType=configurations) (available only for internal contributors) with proper documentation. In the case of an already existing key the behavior needs to be verified in order to know if a new version of the same key needs to be created on the registry.
6769

6870
Edit the `supported-configurations.json` file and add your variable (Please keep any new keys in the file sorted!):
6971

@@ -80,18 +82,20 @@ Edit the `supported-configurations.json` file and add your variable (Please keep
8082
#### Configuration Structure
8183

8284
- **supportedConfigurations**: Maps variable names to configuration metadata
83-
- `version`: (Currently always set to `["A"]`) Array indicating which implementations the tracer supports. Implementations are defined in the Feature Parity Dashboard and multiple implementations could be set for a single environment variable (e.g. the base one `A`, and an extra one `B` that adds new possible values). Versions are non-numeric to avoid confusion with library versions.
85+
- `version`: (Defaults to `["A"]`) Array indicating which implementations the tracer supports. Implementations are defined in the Configuration Registry and multiple implementations could be set for a single environment variable (e.g. the base one `A`, and an extra one `B` that adds new possible values). Versions are non-numeric to avoid confusion with library versions.
8486

8587
In the future, the structure will also contain more information such as the type, the default value...
8688

8789
- **aliases**: Maps canonical variable names to arrays of alias names
90+
8891
```json
8992
"aliases": {
9093
"DD_SERVICE": ["OTEL_SERVICE_NAME"]
9194
}
9295
```
9396

9497
- **deprecations**: Adds a log message to deprecated environment variables.
98+
9599
```json
96100
"deprecations": {
97101
"DD_OLD_VARIABLE": "Please use DD_NEW_VARIABLE",
@@ -151,6 +155,28 @@ rescue RuntimeError => e
151155
end
152156
```
153157

158+
### CI jobs
159+
160+
#### Local file validation
161+
162+
The `validate_supported_configurations_local_file` CI job in charge of validating the content of the `supported-configurations.json` file against the central Configuration Registry runs on GitLab in the `shared-pipeline` stage. This job verifies that all configuration keys present in the local file are correctly registered on the central registry. When a new key is introduced it has to be registered in order to pass this job.
163+
164+
Example of a failed run output:
165+
166+
```json
167+
Missing properties:
168+
{
169+
"DD_TRACE_GRAPHQL_ERROR_TRACKING": [
170+
"A"
171+
]
172+
}
173+
The above configuration was found locally but missing from the configuration registry.
174+
```
175+
176+
#### Updating supported versions
177+
178+
The `update_central_configurations_version_range` CI job runs upon tagging a new release. This job updates the central registry with the new version released indicating newly supported or dropped configuration keys.
179+
154180
## Validation
155181

156182
To ensure your configuration changes are valid:
@@ -159,6 +185,7 @@ To ensure your configuration changes are valid:
159185
# Validate that generated assets match the JSON file
160186
bundle exec rspec spec/datadog/core/configuration/supported_configurations_spec.rb
161187
```
188+
162189
This will also be run by the main RSpec rake task.
163190

164191
This task will exit with an error if there's a mismatch between `supported-configurations.json` and the generated assets. It is run by the CI, thus a mismatch will make the CI fail.

0 commit comments

Comments
 (0)