Skip to main content

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.

SubcommandPurpose
stacksValidate stack manifest configurations.
componentValidate an Atmos component in a stack using JSON Schema or OPA policies.
schemaValidate YAML files against JSON schemas defined in atmos.yaml.
editorconfigValidate all files against the EditorConfig.
configValidate atmos.yaml against its JSON Schema.
ciValidate 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 for component or workflow files for ci. 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". The component subcommand 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.run for 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"})