Repository navigation
Consolidate atmos-manifest schema, publish per-release pins - #2749
Conversation
…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
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned Files
|
|
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. |
|
Important Cloud Posse Engineering Team Review RequiredThis 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 |
…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 Report❌ Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
…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.
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Warning Release Documentation RequiredThis PR is labeled
|
|
These changes were released in v1.223.1-rc.1. |
…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.
what
atmos.toolsand the copy embedded in the CLI binary) into a single source of truth: the embedded schema.atmos.tools/schemas/atmos/atmos-manifest/<version>/atmos-manifest.json) alongside the existing floating1.0copy.atmos stack schema [output-path], a real CLI subcommand that prints/writes the embedded schema, replacing a throwawaygo run ./tools/gen-schemascript used only during development.schemas.atmos.manifestversion pins from examples/fixtures that weren't demonstrating custom-schema usage.why
atmosbinary could silently change what a pinnedatmos.yamlvalidates against, with no way to pin to "the schema as of release X."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.references
versioned-manifest-schema,atmos-stack-schema-command