Skip to content

Commit e2b4bd3

Browse files
authored
Allow top-level keys starting with x- or x_ in deployment maps (#347)
This allows users to define anchors in one place Signed-off-by: Simon <[email protected]>
1 parent b5b333d commit e2b4bd3

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

docs/user-guide.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,23 @@ pipelines:
615615
targets: *generic_targets
616616
```
617617

618+
If you want to define anchors before you use them as an alias, you can use any top-level key that starts with `x-` or `x_`. For example, if you want to define all account ids in one place, you could write:
619+
620+
```yaml
621+
x_account_ids:
622+
- &codecommit_account: "111111111111"
623+
- &some_target_account: "222222222222"
624+
pipelines:
625+
- name: sample-vpc
626+
default_providers:
627+
source:
628+
provider: codecommit
629+
properties:
630+
account_id: *codecommit_account
631+
targets:
632+
- *some_target_account
633+
```
634+
618635
For more advanced yaml usage, see [here](https://learnxinyminutes.com/docs/yaml/)
619636

620637
### One to many relationships

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/schema_validation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,10 @@
302302
Optional("completion_trigger"): COMPLETION_TRIGGERS_SCHEMA
303303
}
304304
TOP_LEVEL_SCHEMA = {
305-
"pipelines": [PIPELINE_SCHEMA]
305+
"pipelines": [PIPELINE_SCHEMA],
306+
# Allow any toplevel key starting with "x-" or "x_".
307+
# ADF will ignore these, but users can use them to define anchors in one place.
308+
Optional(Regex('^[x][-_].*')): object
306309
}
307310

308311
class SchemaValidation:

0 commit comments

Comments
 (0)