Validating Stack Configurations
Validation is essential for ensuring clean and correct configurations, especially in environments where multiple teams contribute to the development and deployment processes. Atmos enhances this validation process in two significant ways with JSON Schema and OPA policies.
Types of Validation
Atmos supports two types of native validation.
JSON Schema
Atmos supports JSON Schema validation, which can validate the schema of configurations such as stacks, workflows, and vendoring manifests. JSON Schema is an industry standard and provides a vocabulary to annotate and validate JSON documents for correctness.
Open Policy Agent (OPA)
The Open Policy Agent (OPA, pronounced “oh-pa”) is another open-source industry standard that provides a general-purpose policy engine to unify policy enforcement across your stacks. The OPA language (Rego) is a high-level declarative language for specifying policy as code. Atmos has native support for the OPA decision-making engine to enforce policies across all the components in your stacks (e.g. for microservice configurations).
This is powerful stuff: because you can define many policies, it's possible to validate components differently for different environments or teams.
Validate Your Configurations
Refer to atmos validate component CLI command for more information
Check Your Stacks
To validate all Stack configurations and YAML syntax, execute the validate stacks
command:
atmos validate stacks
The command checks and validates the following:
-
All YAML manifest files for YAML errors and inconsistencies
-
All imports: if they are configured correctly, have valid data types, and point to existing manifest files
-
Schema: if all sections in all YAML manifest files are correctly configured and have valid data types
-
Misconfiguration and duplication of components in stacks. If the same Atmos component in the same Atmos stack is defined in more than one stack manifest file, and the component configurations are different, an error message will be displayed similar to the following:
For more details, refer to atmos validate stacks
CLI command