atmos.validate
The atmos.validate function runs atmos validate through the current Atmos executable. Use it to validate the
configuration schema, stack manifests, components, EditorConfig rules, and GitHub Actions workflows, and to turn
the result into a pass or fail decision in automation.
Usage
atmos.validate(
*positionals,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)
Subcommands
Pass the subcommand and any positional arguments as strings before the keyword arguments. The bare call
atmos.validate() runs atmos validate, which validates the configuration schema, stack manifests, EditorConfig
rules, and GitHub Actions workflows in one pass. The call atmos.validate("stacks") runs atmos validate stacks.
| Subcommand | Purpose |
|---|---|
stacks | Validate stack manifest configurations. |
component | Validate an Atmos component in a stack using JSON Schema or OPA policies. |
schema | Validate YAML files against JSON schemas defined in atmos.yaml. |
editorconfig | Validate all files against the EditorConfig. |
config | Validate atmos.yaml against its JSON Schema. |
ci | Validate GitHub Actions workflow files. |
See the atmos validate command reference for the complete list of subcommands and
flags.
Arguments
*positionals(Optional) Strings placed on the command line right after
validate, in order: the subcommand and its positional arguments, such as the component name forcomponentor workflow files forci. Every value must be a string.flags(Optional) A dictionary of command-line options; see flag translation. A bare key such as
"format"becomes--format, and registered shorthands such as"s"resolve to--stack. Common keys are"affected","base","exclude", and"format". Thecomponentsubcommand also takes"stack","schema-path","schema-type","module-paths", and"timeout".args- (Optional) A list or tuple of strings appended after the flags.
working_directory,env,output,check(Optional) See
atmos.runfor process options and defaults.
Options other than the positionals are keyword-only.
Returns
A result with stdout, stderr, and exit_code. See atmos.run for output and error behavior.
Examples
Validate the whole project
atmos.validate()
With the default check=True, a validation failure raises an error and stops the script.
Validate one component in a stack
atmos.validate("component", "station", flags = {"stack": "dev"})
This runs atmos validate component station --stack=dev.
Validate with an OPA policy
atmos.validate(
"component",
"vpc",
flags = {
"stack": "prod",
"schema-type": "opa",
"schema-path": "vpc/validate-vpc.rego",
"timeout": 15,
},
)
Report problems without stopping
result = atmos.validate("stacks", output = "capture", check = False)
if result.exit_code != 0:
ui.warning("Stack validation reported problems.")
print(result.stderr)
else:
ui.success("Stack validation passed.")
Validate only what changed
atmos.validate(flags = {"affected": True, "base": "origin/main"})
Related
atmos.runruns any Atmos command from an argument list.atmos validatedocuments every subcommand and flag.- Atmos Automation Language and the script step