Skip to content

feat: compute stack values with !starlark - #3286

Merged
Andriy Knysh (aknysh) merged 15 commits into
osterman/git-hook-script-stepsfrom
osterman/starlark-yaml-values
Oct 14, 2026
Merged

Andriy Knysh (aknysh) merged 15 commits into
osterman/git-hook-script-stepsfrom
osterman/starlark-yaml-values

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

what

Add !starlark to stack manifests. A scalar body uses return to produce typed configuration values from read-only ctx.vars, ctx.metadata, settings, environment, and component identity.

Expressions run after the existing YAML-function merges, resolve other computed values on access, and report circular dependencies. Literal source survives Go templates and retains its original filename and line. Configuration evaluation uses the interpreter registry with a separate typed-value capability and a 100,000-step budget.

Add the PRD, YAML-function reference, language-overview link, and roadmap milestone. Explain !starlark in the main Atmos Automation Language announcement, with a resource-tags example and a redirect from the consolidated post. This PR contains fewer than 150 changed files.

The schema ratchet classifies !starlark as stack-manifest-only. The lint and TFLint-hook CI jobs use the shared toolchain action to reuse the build job's verified binaries and avoid redundant release-attestation API calls.

why

Define tags, generated lists, and environment-specific values once, then compute them for each component's final configuration. The configuration host provides language builtins and JSON conversion; executable scripts provide commands, prompts, and the step library.

CI repairs

Reuse the shared CI toolchain cache, classify the new YAML tag for schema generation, stop SHA-pin lookups after API quota exhaustion, and pass large diagnostics between action steps through a file. Bound PR diagnostic tables, remove summed environment allocation capacities flagged by CodeQL, and make the controller-runtime NOTICE license URL deterministic. Incorporate the lower-stack formatting-bot commit while retaining the correct URL so GitHub’s combined stack checkout preserves it. Classify !starlark as forbidden in selection metadata because its context dependencies can require authentication or command execution.

validation

  • Runtime, function registry, source preservation, YAML utilities, and dependency-selection tests.
  • YAML/template regression tests, including inheritance, deferred map merging, cycle detection, and preservation of returned strings as data.
  • Race tests for configuration evaluation and parallel component contexts.
  • CLI checks for development and production overrides, existing YAML-function dependencies, help, and invalid source diagnostics.
  • Repository Go build, scoped lint, formatting, navigation tests, and production documentation build.
  • Offline SHA-verifier regression tests, environment merge tests, and NOTICE-generator tests.
  • Complete selector package suite, including Starlark expression, multiline, and nested-map rejection.
  • Focused script runner and standalone CLI tests; signed commit hooks; consolidated announcement HTML and redirect checks.
  • Complete configuration-schema tests and schema regeneration (no artifact changes), cached-tool install regression, and workflow actionlint.

The full internal/exec short suite hit its 10-minute timeout. The scoped YAML/template regression suite passed.

references

Summary by CodeRabbit

  • New Features

    • Added !starlark expressions in stack manifests to compute typed configuration from merged component context. Expressions can reference other computed values, with dependency cycles reported as errors.
    • Terraform generators now use resolved component values when determining stack names, workspaces, and output paths.
  • Documentation

    • Added guidance and examples for computed YAML values, including supported locations, evaluation behavior, and limitations.
  • Bug Fixes

    • Preserved Starlark expressions through YAML and template processing so they evaluate against the final merged configuration.

@osterman Erik Osterman (Cloud Posse) (osterman) added the minor New features that do not break anything label Oct 6, 2026
@atmos-pro

atmos-pro Bot commented Oct 6, 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.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: cloudposse/atmos/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9bcc90c3-36a9-4af2-b355-aa95abfe4640
📥 Commits

Reviewing files that changed from the base of the PR and between f1a5b8a and c457403.

📒 Files selected for processing: 2
  • .github/workflows/test.yml
  • internal/exec/terraform_generate_context_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

This pull request adds !starlark computed values to stack-manifest processing. It evaluates expressions against merged component context, integrates deferred resolution with Terraform generation, and adds related documentation, CI toolchain, and script-runner updates.

Changes: Starlark-computed YAML values

Layer / File(s) Summary
Recognize and preserve Starlark source
pkg/function/starlarksource/*, pkg/utils/yaml_*, pkg/function/tag/*, pkg/function/tags*, pkg/tags/selector*, pkg/config/schema/ratchet_test.go, internal/exec/template_utils.go, internal/exec/yaml_processor.go, pkg/deferred/evaluation*, docs/fixes/2026-10-06-starlark-yaml-schema-classification.md
YAML handling records Starlark source and location, protects it during template processing, registers the tag, and rejects it in selectors and non-stack-manifest configuration.
Evaluate Starlark configuration values
pkg/script/evaluation.go, pkg/script/starlark/evaluation*, pkg/script/starlark/evaluation_*, pkg/function/context.go, pkg/function/defaults.go, pkg/function/starlark*
The script API and Starlark engine evaluate function bodies against read-only configuration mappings. Conversion, cancellation, execution limits, and evaluation errors are handled.
Resolve computed configuration dependencies
internal/exec/yaml_func_starlark*, internal/exec/yaml_func_utils.go, internal/exec/utils.go, internal/exec/describe_stacks_component_processor.go, internal/exec/yaml_processor.go, pkg/deferred/evaluation.go
The resolver evaluates nested values, caches results by path, and reports circular dependencies. Stack processing defers Starlark evaluation until after YAML functions and typed merges.
Refresh Terraform generator context
internal/exec/terraform_generate_backends.go, internal/exec/terraform_generate_varfiles.go, internal/exec/terraform_generate_context.go, internal/exec/terraform_generate_*_test.go, docs/fixes/2026-10-06-terraform-generators-computed-context.md
Backend and varfile generation prepare and finalize computed values, then refresh stack naming and workspace context. Tests cover merged values, filtering, naming, and errors.
Document computed YAML values
docs/prd/starlark-*.md, website/docs/automation/language.mdx, website/docs/functions/yaml/*, website/blog/2026-10-03-starlark-custom-commands.mdx, website/src/data/roadmap.js, website/docusaurus.config.js, pkg/merge/merge_yaml_functions.go
PRDs, product documentation, and a blog describe !starlark syntax, context, evaluation, and restrictions. The roadmap and redirect reflect the feature.

CI toolchain cache reuse

Layer / File(s) Summary
Use the shared toolchain cache
.github/workflows/test.yml, docs/fixes/2026-10-06-tflint-ci-cache-reuse.md
The lint and TFLint hook jobs use the shared toolchain action in restore-only mode and add download hosts to their allowlists.

Script runner updates

Layer / File(s) Summary
Update script runner call arguments
pkg/script/starlark/atmos.go, pkg/script/starlark/process.go, cmd/standalone_script.go, docs/fixes/2026-10-06-script-runner-lint.md
Script process calls pass processCall by pointer. The standalone script reader no longer has a gosec suppression.

Repository documentation corrections

Layer / File(s) Summary
Record documentation and NOTICE corrections
docs/fixes/2026-10-06-automation-reference-review-corrections.md, docs/fixes/2026-10-06-controller-runtime-notice-url.md
Fix records cover automation-reference details and the controller-runtime URL in the combined stack checkout.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant StackProcessing
  participant ConfigurationResolver
  participant StarlarkEngine
  StackProcessing->>ConfigurationResolver: finalize computed component values
  ConfigurationResolver->>StarlarkEngine: evaluate source with component context
  StarlarkEngine-->>ConfigurationResolver: return typed value or error
  ConfigurationResolver-->>StackProcessing: return resolved component section
Loading

Suggested labels: patch

Suggested reviewers: goruha

Merge Risk: ⚪ Minimal · up to c4574

The reviewed changes switch the lint CI jobs to the shared toolchain action and add regression tests for Terraform generation. No merge-blocking risk was found in these changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 32.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 90 functions across 56 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the primary change: adding !starlark to compute stack values. It matches the pull request objectives and changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 32.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 90 functions across 56 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 6, 2026
@mergify

mergify Bot commented Oct 6, 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.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Warning

SHA Pin Verification Passed — with documented exceptions

All 248 third-party action reference(s) are covered, but 2 rely on a documented allowlist entry in allowlist.json and could not be automatically drift-checked. This does not fail CI, but should be reviewed.

Action Location Status Details
aquasecurity/[email protected] build.yml:169 ⚠️ Allowlisted (documented) The aquasecurity GitHub organization has enabled an IP allow list that blocks API access (git ref/tag lookups) from GitHub-hosted Actions runner IPs, for any caller, on any of their repos, including public ones — this is not specific to our token or workflow. Verified independently: the exact same 4
aquasecurity/[email protected] test.yml:1302 ⚠️ Allowlisted (documented) The aquasecurity GitHub organization has enabled an IP allow list that blocks API access (git ref/tag lookups) from GitHub-hosted Actions runner IPs, for any caller, on any of their repos, including public ones — this is not specific to our token or workflow. Verified independently: the exact same 4

See the action run for full details.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 6, 2026

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 10, 2026

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 11, 2026

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 12, 2026
@osterman

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@atmos-pro

atmos-pro Bot commented Oct 14, 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.

@atmos-pro

atmos-pro Bot commented Oct 14, 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.

@github-actions

Copy link
Copy Markdown

These changes were released in v1.233.0-rc.0.

This branch was successfully deployed

1 active and 1 inactive deployments
preview — c4574038 Deployed Oct 13, 2026 by github-actions[bot]
screengrabs — c4574038 Deployed Oct 13, 2026 by osterman via build #3260
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/l Large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants