Skip to content

Consolidate atmos-manifest schema, publish per-release pins - #2749

Merged
Andriy Knysh (aknysh) merged 7 commits into
mainfrom
osterman/automate-issue-2592-fix
Jul 16, 2026
Merged

Andriy Knysh (aknysh) merged 7 commits into
mainfrom
osterman/automate-issue-2592-fix

Conversation

@osterman

Copy link
Copy Markdown
Member

what

  • Consolidates the two hand-maintained atmos-manifest JSON Schema copies (the website copy at atmos.tools and the copy embedded in the CLI binary) into a single source of truth: the embedded schema.
  • The website copy is no longer committed — it's gitignored and generated at build time from the embedded schema.
  • Every Atmos release now publishes an immutable, version-pinned schema snapshot (atmos.tools/schemas/atmos/atmos-manifest/<version>/atmos-manifest.json) alongside the existing floating 1.0 copy.
  • Adds atmos stack schema [output-path], a real CLI subcommand that prints/writes the embedded schema, replacing a throwaway go run ./tools/gen-schema script used only during development.
  • Removes hardcoded schemas.atmos.manifest version pins from examples/fixtures that weren't demonstrating custom-schema usage.

why

  • The published schema was a single mutable file — upgrading the atmos binary could silently change what a pinned atmos.yaml validates against, with no way to pin to "the schema as of release X."
  • The website and embedded schema copies had quietly drifted apart (missing dependencies, generate, provision, source, and dozens of workflow step fields in one or the other), so validation behavior differed depending on which copy you hit.
  • Schema export deserves a discoverable, real CLI command instead of an internal-only script nobody would find.

references

…d `atmos stack schema`

Consolidates the two hand-maintained atmos-manifest JSON Schema copies (website and
CLI-embedded) into one source of truth embedded in the atmos binary. The website copy
is now generated at build time instead of committed, and every release publishes an
immutable, version-pinned schema snapshot alongside the existing floating `1.0` copy,
so upgrading the binary no longer silently changes what stack YAML validates against.

Also adds `atmos stack schema [output-path]`, a real CLI subcommand for printing/writing
the embedded schema, replacing the throwaway `tools/gen-schema` script used during
development.

Closes #2592
@atmos-pro

atmos-pro Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@osterman Erik Osterman (Cloud Posse) (osterman) added the minor New features that do not break anything label Jul 13, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

  • .github/workflows/website-preview-build.yml

@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

This PR exceeds the recommended limit of 10,000 lines.

Large PRs are difficult to review and may be rejected due to their size.

Please verify that this PR does not address multiple issues.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Jul 13, 2026
…review

`go run . stack schema` builds the whole atmos module graph, unlike the
deleted `tools/gen-schema`'s narrower import footprint. That graph includes
cgo-linked hardware-security-key deps (github.com/bearsh/hid) which need
system libudev headers this workflow's runner doesn't have, failing the
website-deploy-preview job. atmos itself always builds with CGO disabled
(.goreleaser.yml, scripts/build-atmos.sh) — set CGO_ENABLED=0 for the same
invocation in both website workflows and the atmos dev generate schema step.
… set

atmos validate stacks was silently skipping JSON Schema validation whenever
schemas.atmos.manifest wasn't configured: the default-embedded-schema branch
resolved the embedded schema file but assigned it to a local variable that
was never read, leaving the path actually used downstream empty. Two
acceptance tests never caught this because they always passed an explicit
schema path.

Also update those two tests to rely on the default embedded schema instead
of a committed website/static/... file, since that file is now gitignored
and generated at build time (see 8206b83).
@codecov

codecov Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.87%. Comparing base (6b3b0ef) to head (a8671fc).

Files with missing lines Patch % Lines
cmd/stack/schema.go 90.90% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2749      +/-   ##
==========================================
- Coverage   81.90%   81.87%   -0.03%     
==========================================
  Files        1719     1720       +1     
  Lines      162175   162198      +23     
==========================================
- Hits       132823   132806      -17     
- Misses      22091    22119      +28     
- Partials     7261     7273      +12     
Flag Coverage Δ
unittests 81.87% <91.66%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/stack/stack.go 100.00% <100.00%> (ø)
internal/exec/validate_stacks.go 82.20% <100.00%> (-1.23%) ⬇️
cmd/stack/schema.go 90.90% <90.90%> (ø)

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify

mergify Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Jul 14, 2026
…ue-2592-fix

# Conflicts:
#	website/static/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
Post-merge gap: main's native archive step type (type: archive) added
format/destination/subpath/include/exclude/mtime fields to WorkflowStep
that weren't yet modeled in the embedded schema (the single source of
truth after the schema consolidation work). Caught by
TestSchemaCoversWorkflowStepFields.
@aknysh
Andriy Knysh (aknysh) merged commit 0485a62 into main Jul 16, 2026
77 checks passed
@atmos-pro

atmos-pro Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@aknysh
Andriy Knysh (aknysh) deleted the osterman/automate-issue-2592-fix branch July 16, 2026 01:47
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Jul 16, 2026
@github-actions

Copy link
Copy Markdown

Warning

Release Documentation Required

This PR is labeled minor or major and requires documentation updates:

  • Changelog entry - Add a blog post in website/blog/YYYY-MM-DD-feature-name.mdx
  • Roadmap update - Update website/src/data/roadmap.js with the new milestone

Alternatively: If this change doesn't require release documentation, remove the minor or major label.

@github-actions

Copy link
Copy Markdown

These changes were released in v1.223.1-rc.1.

Michael Pursifull (arcaven) pushed a commit to arcaven/atmos that referenced this pull request Aug 19, 2026
…loudposse#2950)

* fix(schema): model required_version/required_providers/retry and native Helm in atmos-manifest schema

Fixes cloudposse#2948: `atmos validate stacks`/`atmos describe stacks` reject
`required_version`, `required_providers`, and `retry` under
`components.terraform.<name>` (and the shared `overrides` block) even
though they're fully supported by the stack processor. The fields were
added to the legacy, unenforced `stack-config` schema by cloudposse#1841 but
never ported to `atmos-manifest`, the schema actually enforced by
validate/describe — drift that stayed invisible until cloudposse#2749 fixed a
separate bug that had been silently skipping schema validation by
default.

- Add `required_version`/`required_providers`/`retry` to the
  `terraform`, `terraform_component_manifest`, and `overrides`
  definitions.
- Add `generate` to the stack-level `kubernetes` definition (same
  drift class, found auditing for other instances).
- Model native Helm (`helm`, `helm_repository`, `helm_components`,
  `helm_component_manifest`), closing the tracked `topLevel:helm` gap
  in the schema-coverage guard.
- Fix `schema_section_coverage_test.go`: `required_version`,
  `required_providers`, and `retry` were explicitly exempted from the
  coverage guard with the comment "introspected from Terraform, not
  authored" — factually wrong, since they're user-authored fields with
  full stack-processor support. This exemption is why the guard never
  caught the original gap; verified it now fails without the schema
  fix and passes with it.
- Sync the same edits into the `tests/fixtures/schemas/...` copy and
  extend the `atmos-stacks-validation` fixture with real usage of all
  the fixed fields, so `TestValidateStacksCmd_Success` is a live
  regression guard for this bug class.

Closes cloudposse#2948

* fix(schema): address CodeRabbit findings on PR cloudposse#2950

Verified each finding against the actual stack-processor code before
applying (per CodeRabbit's own review instructions) rather than
applying suggestions blindly:

- Sync the native Helm definitions (helm, helm_repository,
  helm_components, helm_component_manifest, plus their plugins/
  kubernetes_render dependencies) into the
  tests/fixtures/schemas/... copy, which lacked them entirely — valid,
  the fixture was silently permissive on Helm fields instead of
  validating them.
- Add locals/command/secrets to helm_component_manifest and accept
  the `^!include` string form for `values` — verified all three
  sections are read unconditionally for every component type
  (internal/exec/stack_processor_process_stacks_helpers_extraction.go),
  not gated to specific types, so Helm components support them too.
- Tighten required_providers' additionalProperties from true to false
  on both the provider map and each provider entry, matching the
  documented source/version/configuration_aliases contract, in both
  the canonical and fixture schema copies.

Skipped one sub-claim: adding `locals`/`overrides` to the top-level
`helm` type-defaults object. Neither is read from `globalHelmSection`
in internal/exec/stack_processor_process_stacks.go, and the nested
type-level `overrides:` mechanism (internal/exec/stack_processor_utils.go)
only wires up terraform/helmfile, not helm/kubernetes/packer — adding
them to the schema would validate configuration the stack processor
silently ignores.

* fix(test): stop schema-drift fixture from polluting shared mock component

The stack-wide `terraform: { required_version, required_providers, retry,
overrides }` block added to tests/fixtures/scenarios/atmos-stacks-validation
cascaded into `component-1`, which internal/exec/terraform_test.go's
TestExecuteTerraform_OpaValidation runs real `terraform plan`/`apply`
against. Since that component has no JIT source-provisioning, Atmos's
generateRequiredProviders step (invoked from the plan/apply pipeline)
wrote a `terraform_override.tf.json` directly into the shared, checked-in
tests/fixtures/components/terraform/mock/ directory instead of an
isolated workdir — polluting every other test reusing that component for
the rest of the CI run:

- describe_component_with_stack_flag's golden snapshot picked up the
  leaked required_version/required_providers via tfconfig.LoadModule().
- atmos_vendor_pull#01/atmos_vendor_simple_exclude/
  atmos_vendor_combined_exclude_include failed on a corrupted/incomplete
  shared hashicorp/time provider plugin-cache entry from the stray
  `terraform init` the leaked required_providers triggered.

Remove the stack-wide block (component-level required_version/
required_providers/retry on the new, never-executed
component-test-required-providers component is unaffected and stays).
Add TestValidateStacksAcceptsRequiredProvidersRetryAndKubernetesGenerate
to internal/exec/validate_stacks_test.go instead, covering stack-level
terraform.required_version/required_providers/retry, the shared
overrides definition, and kubernetes.generate via ValidateStacks only
(schema validation, never ExecuteTerraform) in an isolated t.TempDir()
-- carrying none of the pollution risk.

Verified locally: ran TestExecuteTerraform_OpaValidation and confirmed
no terraform_override.tf.json is written into the shared mock directory;
re-ran the four previously-failing CI tests, all pass.

* fix(schema): sync stack-level kubernetes route into the fixture schema

CodeRabbit: the fixture root exposed no `kubernetes` property, so it
could not enforce the `kubernetes.generate` contract exercised by
TestValidateStacksAcceptsRequiredProvidersRetryAndKubernetesGenerate
(that test currently validates via the default embedded schema, so it
wasn't failing, but the fixture is meant to mirror the enforced schema
per the project's established three-file sync pattern).

Port the full kubernetes definition family from the canonical schema
(kubernetes, kubernetes_provider, kubernetes_paths, kubernetes_manifest,
kubernetes_manifests, kubernetes_components, kubernetes_component_manifest
-- kubernetes_render was already added for native Helm's sake) and wire
kubernetes into the fixture's root properties and components definition.

Verified by validating stacks with an explicit kubernetes.generate block
against this exact fixture file (schemas.atmos.manifest override), not
just the embedded default.

* fix(security): resolve CodeQL go/allocation-size-overflow alerts

pkg/workflow/container.go's mergeEnvSlices sized two allocations off
len(base)+len(overlay), the summed-len() capacity-hint pattern CodeQL
flags as a potential overflow (alerts #5326-#5329). Size off len(base)
instead, matching the established fix from 0e32451.

Dependabot alerts cloudposse#275/cloudposse#276 (image-size, high severity, transitive via
website/pnpm-lock.yaml) remain open: GitHub reports
first_patched_version: null for both, and the npm registry confirms
2.0.2 (the currently-pinned version) is the latest published release.
No fix exists upstream yet.

This branch was successfully deployed

1 active deployment
preview — a8671fc6 Deployed Jul 15, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features that do not break anything size/xxl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please publish a new atmos manifest version with each atmos release

2 participants