Skip to content

v1.51.0

Compare
Choose a tag to compare
@aknysh aknysh released this 09 Dec 15:10
· 219 commits to main since this release
96195bb

what

why

  • examples/quick-start is an example of a deployable infrastructure with Atmos stacks and components

  • Update Quick Start docs with more steps and to point to the examples/quick-start infrastructure

  • Add JSON Schema for Atmos manifests validation. Update atmos validate stacks to use the Atmos manifests validation JSON Schema.

Atmos Manifest JSON Schema

Atmos Manifest JSON Schema can be used to validate Atmos stack manifests and provide auto-completion.

Validate and Auto-Complete Atmos Manifests in IDEs

In supported editors like JetBrains IDEs, Microsoft Visual Studio or Visual Studio Code, the schema can offer auto-completion and validation to ensure that Atmos stack manifests, and all sections in them, are correct.

A list of editors that support validation using JSON Schema can be found here.

Validate Atmos Manifests on the Command Line

Atmos can use the Atmos Manifest JSON Schema to validate Atmos stack manifests on the command line by executing the command atmos validate stacks.

For this to work, configure the following:

  • Add the Atmos Manifest JSON Schema to your repository, for example in schemas/atmos-manifest/1.0/atmos-manifest.json

  • Configure the following section in the atmos.yaml CLI config file

    # Validation schemas (for validating atmos stacks and components)
    schemas:
      # JSON Schema to validate Atmos manifests
      atmos:
        # Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
        # Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
        manifest: "schemas/atmos-manifest/1.0/atmos-manifest.json"
  • Execute the command atmos validate stacks

  • Instead of configuring the schemas.atmos.manifest section in atmos.yaml, you can provide the path to
    the Atmos Manifest JSON Schema file by using the ENV variable ATMOS_SCHEMAS_ATMOS_MANIFEST or the --schemas-atmos-manifest command line argument:

    ATMOS_SCHEMAS_ATMOS_MANIFEST=schemas/atmos-manifest/1.0/atmos-manifest.json atmos validate stacks
    atmos validate stacks --schemas-atmos-manifest schemas/atmos-manifest/1.0/atmos-manifest.json

In case of any validation errors (invalid YAML syntax, Atmos manifest JSON Schema errors, invalid imports, etc.), you'll get an output from the command similar to the following:

Atmos manifest JSON Schema validation error in the 
file 'catalog/invalid-yaml-and-schema/invalid-import-5.yaml':
{
  "valid": false,
  "errors": [
    {
      "keywordLocation": "",
      "absoluteKeywordLocation": "examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#",
      "instanceLocation": "",
      "error": "doesn't validate with examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#"
    },
    {
      "keywordLocation": "/properties/import/$ref",
      "absoluteKeywordLocation": "examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#/properties/import/$ref",
      "instanceLocation": "/import",
      "error": "doesn't validate with '/definitions/import'"
    },
    {
      "keywordLocation": "/properties/import/$ref/type",
      "absoluteKeywordLocation": "examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#/definitions/import/type",
      "instanceLocation": "/import",
      "error": "expected array, but got object"
    }
  ]
}

Atmos manifest JSON Schema validation error in the 
file 'catalog/invalid-yaml-and-schema/invalid-schema-8.yaml':
{
  "valid": false,
  "errors": [
    {
      "keywordLocation": "",
      "absoluteKeywordLocation": "examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#",
      "instanceLocation": "",
      "error": "doesn't validate with examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#"
    },
    {
      "keywordLocation": "/properties/env/$ref",
      "absoluteKeywordLocation": "examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#/properties/env/$ref",
      "instanceLocation": "/env",
      "error": "doesn't validate with '/definitions/env'"
    },
    {
      "keywordLocation": "/properties/env/$ref/type",
      "absoluteKeywordLocation": "examples/tests/schemas/atmos-manifest/1.0/atmos-manifest.json#/definitions/env/type",
      "instanceLocation": "/env",
      "error": "expected object, but got array"
    }
  ]
}

no matches found for the import 'globals/tenant1-globals-does-not-exist' in the 
file 'catalog/invalid-yaml-and-schema/invalid-import-1.yaml'

invalid import in the file 'catalog/invalid-yaml-and-schema/invalid-import-2.yaml'
The file imports itself in 'catalog/invalid-yaml-and-schema/invalid-import-2'

invalid stack manifest 'catalog/invalid-yaml-and-schema/invalid-yaml-1.yaml'
yaml: line 15: found unknown directive name

invalid stack manifest 'catalog/invalid-yaml-and-schema/invalid-yaml-3.yaml'
yaml: line 13: did not find expected key

invalid stack manifest 'catalog/invalid-yaml-and-schema/invalid-yaml-5.yaml'
yaml: mapping values are not allowed in this context

invalid stack manifest 'catalog/invalid-yaml-and-schema/invalid-yaml-6.yaml'
yaml: line 2: block sequence entries are not allowed in this context

invalid stack manifest 'catalog/invalid-yaml-and-schema/invalid-yaml-7.yaml'
yaml: line 4: could not find expected ':'