-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Imports for overrides
#831
Conversation
📝 WalkthroughWalkthroughThis pull request includes updates to several configuration files. The Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
internal/exec/stack_processor_utils.go (2)
Line range hint
220-230
: Reduce duplication in error handling.Consider refactoring repetitive error return blocks to improve maintainability.
454-472
: Optimize override merging logic.Review the merging of final Terraform and Helmfile overrides to see if it can be streamlined.
website/docs/quick-start/install-atmos.mdx (1)
312-312
: Documentation improvement for better user experienceThe font recommendation enhances readability, though it's unrelated to the override functionality.
Consider moving font recommendations to a separate "Terminal Configuration" section in the documentation.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
website/package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (10)
examples/quick-start-advanced/Dockerfile
(1 hunks)examples/tests/stacks/teams/testing-overrides.yaml
(1 hunks)examples/tests/stacks/teams/testing.yaml
(1 hunks)internal/exec/stack_processor_utils.go
(13 hunks)internal/exec/validate_stacks.go
(1 hunks)pkg/stack/stack_processor.go
(1 hunks)website/docs/core-concepts/stacks/overrides.mdx
(7 hunks)website/docs/integrations/atlantis.mdx
(1 hunks)website/docs/quick-start/install-atmos.mdx
(1 hunks)website/package.json
(2 hunks)
🧰 Additional context used
📓 Learnings (1)
examples/quick-start-advanced/Dockerfile (2)
Learnt from: aknysh
PR: cloudposse/atmos#775
File: examples/quick-start-advanced/Dockerfile:9-9
Timestamp: 2024-11-12T05:52:05.088Z
Learning: It is acceptable to set `ARG ATMOS_VERSION` to a future version like `1.105.0` in `examples/quick-start-advanced/Dockerfile` if that will be the next release.
Learnt from: osterman
PR: cloudposse/atmos#801
File: examples/quick-start-advanced/Dockerfile:9-9
Timestamp: 2024-11-23T00:13:22.004Z
Learning: When updating the `ATMOS_VERSION` in Dockerfiles, the team prefers to pin to the next future version when the PR merges, even if the version is not yet released.
🪛 LanguageTool
website/docs/core-concepts/stacks/overrides.mdx
[grammar] ~68-~68: Did you mean “until” or “up to”?
Context: ...within the manifest and all its imports up until that point. In other words, the `overri...
(UP_UNTIL)
[style] ~112-~112: A comma is missing here.
Context: ...ifests into a top-level stack manifest, e.g. tenant1/dev/us-west-2.yaml
: <File ti...
(EG_NO_COMMA)
[style] ~292-~292: The serial comma (Oxford comma, Harvard comma) is missing.
Context: ...verrides # Override the variables, env, command and settings ONLY in the Terraform componen...
(SERIAL_COMMA_ON)
[style] ~308-~308: Consider using the typographical ellipsis character here instead.
Context: ...https://opentofu.org # The commands atmos terraform <sub-command> ...
will execute the tofu
binary com...
(ELLIPSIS)
[grammar] ~355-~355: Please add a punctuation mark at the end of paragraph.
Context: ...component-overridecomponents, but not to
catalog/terraform/test-component-2` -...
(PUNCTUATION_PARAGRAPH_END)
🔇 Additional comments (17)
internal/exec/stack_processor_utils.go (4)
73-73
: Confirm handling of new return values in ProcessYAMLConfigFile
.
Ensure that ignoring the additional return values in the function call is intentional and doesn't affect the application flow.
199-201
: Check consistency in error return statements.
Verify that all error returns include the new return values to maintain consistency across the function.
283-311
: Validate processing of overrides
sections.
Ensure that the parsing and merging of global, Terraform, and Helmfile overrides correctly reflect the intended hierarchy.
316-331
: Assess merge order of override configurations.
Confirm that the order of merging overrides provides the correct precedence, especially for parent overrides.
examples/quick-start-advanced/Dockerfile (1)
9-9
: Version update to 1.120.0 is acceptable.
Updating ATMOS_VERSION
aligns with team practices and future release planning.
examples/tests/stacks/teams/testing-overrides.yaml (1)
1-40
: Overrides are well-structured and effective.
The configuration correctly implements the desired overrides for the testing team components.
website/package.json (1)
39-39
: Confirm compatibility with updated dependencies.
Ensure that the updates to posthog-js
and prettier
do not introduce any issues in the project.
Also applies to: 55-55
examples/tests/stacks/teams/testing.yaml (3)
4-10
: Well-documented import behavior!
The comments clearly explain the scope and precedence of overrides, which is crucial for maintainability.
33-33
: Well-structured component-specific overrides
The separation between Terraform and Helmfile overrides provides clear organization and follows the DRY principle.
Also applies to: 43-43
21-21
: Verify override propagation
Let's ensure this global override is correctly applied to all components.
✅ Verification successful
Global override is properly structured
The override hierarchy for TEST_ENV_VAR1 is well-defined across the stack:
- Base value in test-component.yaml: "val1"
- Various component-level overrides in different override files
- Final global override in testing.yaml: "test-env-var1-overridden-2"
The global override follows the expected pattern and will take precedence over component-level values, which is the intended behavior.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any hardcoded values of TEST_ENV_VAR1 that might conflict
rg "TEST_ENV_VAR1.*test-env-var1-overridden-2" --type yaml
Length of output: 149
Script:
#!/bin/bash
# Let's check for all occurrences of TEST_ENV_VAR1 to understand the override hierarchy
rg "TEST_ENV_VAR1" --type yaml -A 2
Length of output: 1729
pkg/stack/stack_processor.go (1)
54-55
: Function signature enhancement supports override functionality
The addition of two map return values enhances the override processing capabilities. However, we should ensure proper error handling for these new return values.
✅ Verification successful
Function signature change is properly handled
The function signature change in ProcessYAMLConfigFile
is correctly implemented across the codebase. The function is a wrapper in pkg/stack/stack_processor.go
that delegates to the actual implementation in internal/exec/stack_processor_utils.go
. All callers are using the updated signature with proper error handling, and the new return values (maps) are used for override processing functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for consistent error handling in callers
rg "ProcessYAMLConfigFile.*map\[string\]any.*error" --type go
Length of output: 63
Script:
#!/bin/bash
# Let's first check the function signature and its implementation
ast-grep --pattern 'func ProcessYAMLConfigFile($$$) ($$$)'
# Also check for any calls to this function
rg "ProcessYAMLConfigFile\(" -A 2 --type go
Length of output: 33301
internal/exec/validate_stacks.go (1)
132-132
: LGTM! Function call updated to match new signature.
The ProcessYAMLConfigFile
function call has been correctly updated to include the two additional parameters required by the new function signature.
website/docs/core-concepts/stacks/overrides.mdx (4)
10-10
: LGTM! Added File component import.
The import statement for the File component has been added, which is used to better represent file content in the documentation.
13-14
: LGTM! Improved introduction clarity.
The introduction has been reformatted to improve readability, with better line breaks and clearer explanation of the overrides functionality.
67-69
: LGTM! Enhanced explanation of overrides scope.
The text clearly explains the scope limitations of override configurations within stack manifests.
🧰 Tools
🪛 LanguageTool
[grammar] ~68-~68: Did you mean “until” or “up to”?
Context: ...within the manifest and all its imports up until that point. In other words, the `overri...
(UP_UNTIL)
271-362
: LGTM! Comprehensive new section on importing overrides.
Added a new section that thoroughly explains:
- How to make overrides configuration DRY and reusable
- The process of importing overrides from separate manifests
- The importance of import order
- Precedence rules for inline vs imported overrides
🧰 Tools
🪛 LanguageTool
[style] ~292-~292: The serial comma (Oxford comma, Harvard comma) is missing.
Context: ...verrides # Override the variables, env, command and settings ONLY in the Terraform componen...
(SERIAL_COMMA_ON)
[style] ~308-~308: Consider using the typographical ellipsis character here instead.
Context: ...https://opentofu.org # The commands atmos terraform <sub-command> ...
will execute the tofu
binary com...
(ELLIPSIS)
[grammar] ~355-~355: Please add a punctuation mark at the end of paragraph.
Context: ...component-overridecomponents, but not to
catalog/terraform/test-component-2` -...
(PUNCTUATION_PARAGRAPH_END)
website/docs/integrations/atlantis.mdx (1)
676-676
: LGTM! Updated Atmos version.
The ATMOS_VERSION has been updated from 1.118.0 to 1.120.0, keeping the documentation in sync with the latest release.
@coderabbitai review again |
@aknysh: Understood, I will review the changes. ✅ Actions performedReview triggered.
|
These changes were released in v1.121.0. |
what
overrides
sectionswhy
overrides
configuration DRY and reusable, you can place theoverrides
sections into a separate stack manifest, and then import it into other stacksFor example:
Define the
overrides
sections in a separate manifeststacks/teams/testing-overrides.yaml
:Import the
stacks/teams/testing-overrides.yaml
manifest into the stackstacks/teams/testing.yaml
:NOTES:
The order of the imports is important. The
overrides
inteams/testing-overrides
will affect all the components inthis stack manifest and all the components that are imported after the
overrides
fromteams/testing-overrides
.In other words, the
overrides
inteams/testing-overrides
will be applied to thecatalog/terraform/test-component
and
catalog/terraform/test-component-override
components, but not tocatalog/terraform/test-component-2
On the other hand, the
overrides
defined in this stack manifeststacks/teams/testing.yaml
will be applied to allcomponents defined inline in
stacks/teams/testing.yaml
and all the imported components, includingcatalog/terraform/test-component-2
The
overrides
defined inline in the stack manifeststacks/teams/testing.yaml
take precedence over theoverrides
imported from
teams/testing-overrides
(they will override the same values defined inteams/testing-overrides
)Summary by CodeRabbit