8000 Update `!include` YAML function. Add unit tests. Update docs by aknysh · Pull Request #1179 · cloudposse/atmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update !include YAML function. Add unit tests. Update docs #1179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Apr 1, 2025

Conversation

aknysh
Copy link
Member
@aknysh aknysh commented Mar 30, 2025

what

  • Update !include YAML function
  • Update Atmos JSONSchema for stack manifests validation (to take into account the !include functions)
  • Add unit tests
  • Update docs

why

Make Atmos to resolve the !include functions during the initial phase of YAML stack manifest processing (in contrast to the other YAML functions, which are processed during the very last stage of stack processing).

At this initial stage, the !include functions evaluate and substitute the contents of included files, converting them into the appropriate data types (e.g., string, boolean, map, or list) before assigning them to the corresponding sections or attributes in the Atmos stack configurations.

Key implications of this behavior:

  • The !include functions facilitate stack configuration reuse by enabling modularization of common configurations.
    These configurations can reside in separate local or remote files and be referenced in multiple stack definitions,
    promoting a DRY approach.

  • The functions preprocess YAML files before Atmos resolves stacks and components.
    This enables configuration Inheritance and deep-merging of stack parameters after the !include directives are expanded.

  • When transitioning from plain Terraform/OpenTofu to Atmos, !include allows seamless reuse of existing variable
    files (varfiles) by referencing them in the vars sections of Atmos components:

      my-component:
        vars: !include my-component.tfvars

@aknysh aknysh added the minor New features that do not break anything label Mar 30, 2025
@aknysh aknysh self-assigned this Mar 30, 2025
@aknysh aknysh requested a review from a team as a code owner March 30, 2025 17:14
10000 @mergify Mergify
Copy link
mergify bot commented Mar 30, 2025

Warning

This PR exceeds the recommended limit of 1,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.

Copy link
mergify bot commented Mar 30, 2025

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.

Copy link
codecov bot commented Mar 30, 2025

Codecov Report

Attention: Patch coverage is 55.63380% with 63 lines in your changes missing coverage. Please review.

Project coverage is 28.69%. Comparing base (0d715f5) to head (fe78d78).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/utils/yaml_utils.go 47.94% 29 Missing and 9 partials ⚠️
pkg/utils/file_utils.go 51.85% 9 Missing and 4 partials ⚠️
pkg/utils/go_getter_utils.go 60.00% 4 Missing ⚠️
internal/exec/vendor_component_utils.go 0.00% 3 Missing ⚠️
pkg/utils/cty_utils.go 88.00% 3 Missing ⚠️
internal/exec/validate_stacks.go 0.00% 1 Missing ⚠️
internal/exec/vendor_model.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1179      +/-   ##
==========================================
+ Coverage   28.34%   28.69%   +0.34%     
==========================================
  Files         182      182              
  Lines       21284    21301      +17     
==========================================
+ Hits         6034     6112      +78     
+ Misses      14280    14199      -81     
- Partials      970      990      +20     
Flag Coverage Δ
unittests 28.69% <55.63%> (+0.34%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 1, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 1, 2025
@aknysh aknysh merged commit 834cbdc into main Apr 1, 2025
51 checks passed
@aknysh aknysh deleted the update-include-func branch April 1, 2025 15:02
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Apr 1, 2025
Copy link
github-actions bot commented Apr 1, 2025

These changes were released in v1.169.0.

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/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0