50 lines
2.2 KiB
Markdown
50 lines
2.2 KiB
Markdown
<!-- m-wiki: type=concept slug=cac-validation topic=policy base-sha=28f54cf7bef9 generated-at=2026-05-12T00:00:00+00:00 sources=[] -->
|
|
|
|
> Generated 2026-05-12 at base-sha 28f54cf7bef9. Type: concept. 0 sources.
|
|
|
|
# CAC (Config-as-Code) Validation
|
|
|
|
CAC validation runs `resources/com/meesho/validate_configs_v2.py` on PR builds for repos opted in via the `ValidateCacConfig` whitelist. It validates application YAML configs against a schema to catch misconfigurations before they reach staging.
|
|
|
|
## Where it applies in this repo
|
|
|
|
`src/com/meesho/utilities/constructParam.groovy:ValidateCacConfigForRepo`
|
|
|
|
`resources/com/meesho/validate_configs_v2.py`
|
|
|
|
**Trigger condition:**
|
|
- Build is a PR build (`env.CHANGE_ID` is set).
|
|
- `ValidateCacConfigForRepo(config.ValidateConfig, repo_name)` returns `true`.
|
|
- Either the repo is in the `ValidateCacConfig.yaml` whitelist, OR
|
|
- `config.yaml` has `ValidateConfig: true`.
|
|
|
|
**What gets validated:**
|
|
The script reads `configs/<module>/application-*.yml` files from the service repo and checks them against the CAC schema. Validation errors fail the PR build — the commit cannot be merged until the config is corrected.
|
|
|
|
Used primarily by Go and Maven services. Node, Python, and PHP builders do not call CAC validation.
|
|
|
|
## Why this design
|
|
|
|
Application config files (`application-stg.yml`, `application-prd.yml`) define Spring/Gin/etc. runtime config. A typo or wrong data type in these files doesn't fail compilation but causes a runtime crash after deployment. CAC validation catches these at PR time — when the feedback loop is cheapest.
|
|
|
|
The validation script is bundled as a library resource (`resources/com/meesho/validate_configs_v2.py`) so it travels with the library version rather than requiring a separate checkout.
|
|
|
|
## Related
|
|
|
|
- [Whitelist system](whitelist-system.md) — ValidateCacConfig whitelist that gates this
|
|
- [Config policy](../06-CONFIG-POLICY.md) — constructParam context
|
|
|
|
## Sources
|
|
|
|
(no raw/ sources at bootstrap)
|
|
|
|
## Notes
|
|
|
|
<!-- Anything below is human-owned. wiki-init never reads or modifies content under this heading. -->
|
|
|
|
---
|
|
|
|
[← Wiki index](../../index.md)
|
|
|
|
<!-- atomic: keep this page ≤600 words. New scope → new concept page that builds on this one. Do not append paragraphs here. -->
|