8000 Add `process-templates`, `--process-functions` and `--skip` flags to `atmos describe affected`, `atmos describe component` and `atmos describe stacks` commands by aknysh · Pull Request #1006 · cloudposse/atmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add process-templates, --process-functions and --skip flags to atmos describe affected, atmos describe component and atmos describe stacks commands #1006

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 25 commits into from

Conversation

aknysh
Copy link
Member
@aknysh aknysh commented Feb 3, 2025

what

why

  • Allow executing the commands without evaluating the Go templates and executing the Atmos YAML functions. This will allow you to see the results before and after the templates and functions execution
Flag Description
--process-templates Enable/disable processing of all Go templates
in Atmos stacks manifests when executing the command.
If the flag is not provided, it's set to true by default.
atmos describe affected --process-templates=false
atmos describe component <c> -s <stack> --process-templates=false
atmos describe stacks --process-templates=false
--process-functions Enable/disable processing of all Atmos YAML functions
in Atmos stacks manifests when executing the command.
If the flag is not provided, it's set to true by default.
atmos describe affected --process-functions=false
atmos describe component <c> -s <stack> --process-functions=false
atmos describe stacks --process-functions=false
--skip Skip processing a specific Atmos YAML function
in Atmos stacks manifests when executing the command.
To specify more than one function,
use multiple --skip flags, or separate the functions with a comma:
atmos describe affected --skip=terraform.output --skip=include
atmos describe affected --skip=terraform.output,include
atmos describe component <c> -s <stack> --skip=terraform.output --skip=include
atmos describe component <c> -s <stack> --skip=terraform.output,include
atmos describe stacks --skip=terraform.output --skip=include
atmos describe stacks --skip=terraform.output,include

Summary by CodeRabbit

  • New Features
    • Introduced new command-line flags (e.g., for processing templates, functions, and skipping specific items) that give users greater control over Atmos manifest processing.
  • Documentation
    • Updated help texts, examples, and command descriptions across the CLI to showcase the new flags and usage patterns.
  • Chores
    • Upgraded the Atmos CLI version in sample workflows and refreshed underlying dependencies for improved performance and stability.

@aknysh aknysh added the minor New features that do not break anything label Feb 3, 2025
@aknysh aknysh self-assigned this Feb 3, 2025
@aknysh aknysh requested a review from a team as a code owner February 3, 2025 18:54
Copy link
mergify bot commented Feb 3, 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.

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label Feb 3, 2025
Copy link
Contributor
coderabbitai bot commented Feb 3, 2025
📝 Walkthrough

Walkthrough

This pull request adjusts numerous function calls and signatures across command, execution, package, and documentation files. The changes add extra boolean and nil parameters to key functions (e.g., for describing components, stacks, and processing YAML functions) and introduce new persistent flags such as --process-templates, --process-functions, and --skip. In addition, dependency versions and the Atmos CLI version in the Dockerfile and go.mod are updated. Overall, these modifications standardize the interface of core functions and expose more granular control over processing behavior.

Changes

File(s) Change Summary
cmd/
(cmd/cmd_utils.go, cmd/describe_affected.go, cmd/describe_component.go, cmd/describe_stacks.go, cmd/list_components.go, cmd/list_stacks.go)
Updated function calls (e.g., ExecuteDescribeComponent, ExecuteDescribeStacks) to include extra parameters (booleans and nil). Added persistent flags to control template and YAML function processing.
examples/quick-start-advanced/Dockerfile, go.mod Dockerfile: Upgraded ATMOS_VERSION from 1.156.0 to 1.158.0.
go.mod: Various dependency versions upgraded.
internal/exec/
(atlantis_generate_repo_config.go, atmos.go, aws_eks_update_kubeconfig.go, describe_affected.go, describe_affected_utils.go, describe_component.go, describe_dependents.go, describe_stacks.go, helmfile*.go, template_funcs_component.go, terraform*.go, utils.go, validate_component.go, validate_stacks.go, yaml_func_utils.go)
Modified function signatures and calls (e.g., ProcessStacks, ExecuteDescribeAffected*, ExecuteDescribeComponent, ProcessCustomYamlTags) to accept additional parameters. Introduced new struct fields and helper functions to manage the processing of YAML functions and templates.
pkg/
(component/component_processor.go, describe/, hooks/, list/*)
Propagated the parameter updates in internal function calls and tests. Adjusted test cases to match the new function signatures and made minor formatting edits.
website/docs/
(cli/commands/describe/*.mdx, integrations/atlantis.mdx)
Updated documentation to reflect the new flags (--process-templates, --process-functions, --skip) and version upgrades, ensuring command examples and descriptions are current.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant Cmd as CLI Command
    participant Exec as Executor Module
    participant Util as Processing Function

    U->>Cmd: Run command with new flags (--process-templates, --process-functions, --skip)
    Cmd->>Exec: Parse flags and build command arguments
    Exec->>Util: Invoke function (e.g., ProcessStacks/ExecuteDescribeComponent) with extra parameters
    Util-->>Exec: Return processed results
    Exec-->>Cmd: Aggregate and return outcome
    Cmd-->>U: Display results
Loading

Possibly related PRs

Suggested reviewers

  • osterman
  • Gowiem
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (7)
internal/exec/utils.go (2)

512-512: Consider a more descriptive template identifier
This label is straightforward, but adding a more descriptive identifier can help with troubleshooting.


1205-1251: Modular post-processing routine
Centralizing the field re-assignments in one function is maintainable. For large expansions, consider a more generic mechanism (like struct decoding) to reduce duplication, but this is good for now.

internal/exec/yaml_func_utils.go (1)

87-91: Enhance skipFunc robustness.

The function should handle edge cases and validate inputs.

Consider this improved implementation:

 func skipFunc(skip []string, f string) bool {
+    if f == "" || skip == nil {
+        return false
+    }
     t := strings.TrimPrefix(f, "!")
     c := u.SliceContainsString(skip, t)
     return c
 }
internal/exec/atlantis_generate_repo_config.go (1)

164-166: LGTM! Function calls updated with new parameters.

The updates to the affected-related functions maintain consistency with the new template and function processing capabilities.

Consider extracting these common parameters into a configuration struct to improve maintainability and reduce parameter count. Example:

+type DescribeOptions struct {
+    ProcessTemplates bool
+    ProcessFunctions bool
+    Skip []string
+}

-func ExecuteDescribeAffectedWithTargetRepoPath(..., processTemplates bool, processFunctions bool, skip []string)
+func ExecuteDescribeAffectedWithTargetRepoPath(..., options DescribeOptions)

Also applies to: 179-181, 192-194

website/docs/cli/commands/describe/describe-stacks.mdx (1)

60-70: Refine Flag Description Readability

The flag descriptions—especially for --process-templates, --process-functions, and --skip—are very detailed. Consider splitting longer sentences into shorter ones to enhance readability.

🧰 Tools
🪛 LanguageTool

[style] ~60-~60: This sentence is over 40 words long. Consider splitting it up, as shorter sentences make the text easier to read.
Context: ... to filter the output. ::: ## Flags | Flag | Description | Alias | Required | |:----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------|:---------| | --stack | Filter by a specific stack.
Supports names of the top-level stack manifests
(including subfolder paths),
and Atmos stack names (derived from the context vars) | -s | no | | --file | If specified, write the result to the file | | no | | --format | Specify the output format: yaml or json (yaml is default) | | no | | --components | Filter by specific Atmos components
(comma-separated string of component names) | | no | | --component-types | Filter by specific component types: terraform or helmfile | | no | | --sections | Output only the specified component sections.
Available component sections: backend, backend_type, deps, env,
inheritance, metadata, remote_state_backend,
remote_state_backend_type, settings, vars | | no | | --process-templates | Enable/disable processing of all Go templates
in Atmos stacks manifests when executing the command.
Use the flag to see the stack configurations
before and after the templates are processed.
If the flag is not provided, it's set to true by default.
atmos describe stacks --process-templates=false | | no | | --process-functions | Enable/disable processing of all Atmos YAML functions
in Atmos stacks manifests when executing the command.
Use the flag to see the stack configurations
before and after the functions are processed.
If the flag is not provided, it's set to true by default.
atmos describe stacks --process-functions=false | | no | | --skip | Skip processing a specific Atmos YAML function
in Atmos stacks manifests when executing the command.
To specify more than one function,
use multiple --skip flags, or separate the functions with a comma:
atmos describe stacks --skip=terraform.output --skip=include
atmos describe stacks --skip=terraform.output,include | | no | | --query | Query the results of the command using yq expressions.

atmos describe stacks --query <yq-expression>.

For more details, refer to https://mikefarah.gitbook.io/yq | -q | no |

(TOO_LONG_SENTENCE)

website/docs/cli/commands/describe/describe-component.mdx (1)

68-77: Updated Flag Documentation

The flags table now includes detailed entries for --process-templates, --process-functions, and --skip. While the descriptions are comprehensive, you might consider refining some of the longer sentences to improve overall clarity.

🧰 Tools
🪛 LanguageTool

[style] ~68-~68: This sentence is over 40 words long. Consider splitting it up, as shorter sentences make the text easier to read.
Context: ...mos component | yes | ## Flags | Flag | Description | Alias | Required | |:----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------|:---------| | --stack | Atmos stack | -s | yes | | --format | Output format: yaml or json (yaml is default) | -f | no | | --file | If specified, write the result to the file | | no | | --process-templates | Enable/disable processing of all Go templates
in Atmos stacks manifests when executing the command.
Use the flag to see the component configuration
before and after the templates are processed.
If the flag is not provided, it's set to true by default.
atmos describe component <c> -s <stack> --process-templates=false | | no | | --process-functions | Enable/disable processing of all Atmos YAML functions
in Atmos stacks manifests when executing the command.
Use the flag to see the component configuration
before and after the functions are processed.
If the flag is not provided, it's set to true by default.
atmos describe component <c> -s <stack> --process-functions=false | | no | | --skip | Skip processing a specific Atmos YAML function
in Atmos stacks manifests when executing the command.
To specify more than one function,
use multiple --skip flags, or separate the functions with a comma:
atmos describe component <c> -s <stack> --skip=terraform.output --skip=include
atmos describe component <c> -s <stack> --skip=terraform.output,include | | no | | --query | Query the results of the command using yq expressions.

atmos describe component <c> -s <stack> --query .vars.tags

For more details, refer to https://mikefarah.gitbook.io/yq | -q | no | ## Output The command outputs...

(TOO_LONG_SENTENCE)

website/docs/cli/commands/describe/describe-affected.mdx (1)

220-222: Updated Flags Table for Affected Command

The flag definitions for --process-templates, --process-functions, and --skip are now present in the table. Their detailed descriptions are consistent—though a bit lengthy—and could benefit from minor sentence breaks for readability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6fb9e6 and 6c8c21f.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (42)
  • cmd/cmd_utils.go (1 hunks)
  • cmd/describe_affected.go (1 hunks)
  • cmd/describe_component.go (1 hunks)
  • cmd/describe_stacks.go (1 hunks)
  • cmd/list_components.go (1 hunks)
  • cmd/list_stacks.go (1 hunks)
  • examples/quick-start-advanced/Dockerfile (1 hunks)
  • go.mod (9 hunks)
  • internal/exec/atlantis_generate_repo_config.go (3 hunks)
  • internal/exec/atmos.go (2 hunks)
  • internal/exec/aws_eks_update_kubeconfig.go (1 hunks)
  • internal/exec/describe_affected.go (6 hunks)
  • internal/exec/describe_affected_utils.go (9 hunks)
  • internal/exec/describe_component.go (3 hunks)
  • internal/exec/describe_dependents.go (2 hunks)
  • internal/exec/describe_stacks.go (6 hunks)
  • internal/exec/helmfile.go (1 hunks)
  • internal/exec/helmfile_generate_varfile.go (1 hunks)
  • internal/exec/template_funcs_component.go (1 hunks)
  • internal/exec/terraform.go (1 hunks)
  • internal/exec/terraform_generate_backend.go (1 hunks)
  • internal/exec/terraform_generate_backends.go (1 hunks)
  • internal/exec/terraform_generate_varfile.go (1 hunks)
  • internal/exec/terraform_generate_varfiles.go (1 hunks)
  • internal/exec/terraform_outputs.go (1 hunks)
  • internal/exec/utils.go (4 hunks)
  • internal/exec/validate_component.go (1 hunks)
  • internal/exec/validate_stacks.go (1 hunks)
  • internal/exec/yaml_func_utils.go (2 hunks)
  • pkg/component/component_processor.go (1 hunks)
  • pkg/describe/describe_affected_test.go (2 hunks)
  • pkg/describe/describe_component.go (1 hunks)
  • pkg/describe/describe_component_test.go (7 hunks)
  • pkg/describe/describe_stacks.go (1 hunks)
  • pkg/hooks/cmd.go (1 hunks)
  • pkg/hooks/store.go (0 hunks)
  • pkg/list/list_components_test.go (2 hunks)
  • pkg/list/list_stacks_test.go (2 hunks)
  • website/docs/cli/commands/describe/describe-affected.mdx (2 hunks)
  • website/docs/cli/commands/describe/describe-component.mdx (2 hunks)
  • website/docs/cli/commands/describe/describe-stacks.mdx (2 hunks)
  • website/docs/integrations/atlantis.mdx (1 hunks)
💤 Files with no reviewable changes (1)
  • pkg/hooks/store.go
✅ Files skipped from review due to trivial changes (1)
  • website/docs/integrations/atlantis.mdx
🧰 Additional context used
📓 Learnings (2)
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.
internal/exec/helmfile_generate_varfile.go (1)
Learnt from: Listener430
PR: cloudposse/atmos#825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
🪛 LanguageTool
website/docs/cli/commands/describe/describe-stacks.mdx

[style] ~60-~60: This sentence is over 40 words long. Consider splitting it up, as shorter sentences make the text easier to read.
Context: ... to filter the output. ::: ## Flags | Flag | Description | Alias | Required | |:----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------|:---------| | --stack | Filter by a specific stack.
Supports names of the top-level stack manifests
(including subfolder paths),
and Atmos stack names (derived from the context vars) | -s | no | | --file | If specified, write the result to the file | | no | | --format | Specify the output format: yaml or json (yaml is default) | | no | | --components | Filter by specific Atmos components
(comma-separated string of component names) | | no | | --component-types | Filter by specific component types: terraform or helmfile | | no | | --sections | Output only the specified component sections.
Available component sections: backend, backend_type, deps, env,
inheritance, metadata, remote_state_backend,
remote_state_backend_type, settings, vars | | no | | --process-templates | Enable/disable processing of all Go templates
in Atmos stacks manifests when executing the command.
Use the flag to see the stack configurations
before and after the templates are processed.
If the flag is not provided, it's set to true by default.
atmos describe stacks --process-templates=false | | no | | --process-functions | Enable/disable processing of all Atmos YAML functions
in Atmos stacks manifests when executing the command.
Use the flag to see the stack configurations
before and after the functions are processed.
If the flag is not provided, it's set to true by default.
atmos describe stacks --process-functions=false | | no | | --skip | Skip processing a specific Atmos YAML function
in Atmos stacks manifests when executing the command.
To specify more than one function,
use multiple --skip flags, or separate the functions with a comma:
atmos describe stacks --skip=terraform.output --skip=include
atmos describe stacks --skip=terraform.output,include | | no | | --query | Query the results of the command using yq expressions.

atmos describe stacks --query <yq-expression>.

For more details, refer to https://mikefarah.gitbook.io/yq | -q | no |

(TOO_LONG_SENTENCE)

website/docs/cli/commands/describe/describe-component.mdx

[style] ~68-~68: This sentence is over 40 words long. Consider splitting it up, as shorter sentences make the text easier to read.
Context: ...mos component | yes | ## Flags | Flag | Description | Alias | Required | |:----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------|:---------| | --stack | Atmos stack | -s | yes | | --format | Output format: yaml or json (yaml is default) | -f | no | | --file | If specified, write the result to the file | | no | | --process-templates | Enable/disable processing of all Go templates
in Atmos stacks manifests when executing the command.
Use the flag to see the component configuration
before and after the templates are processed.
If the flag is not provided, it's set to true by default.
atmos describe component <c> -s <stack> --process-templates=false | | no | | --process-functions | Enable/disable processing of all Atmos YAML functions
in Atmos stacks manifests when executing the command.
Use the flag to see the component configuration
before and after the functions are processed.
If the flag is not provided, it's set to true by default.
atmos describe component <c> -s <stack> --process-functions=false | | no | | --skip | Skip processing a specific Atmos YAML function
in Atmos stacks manifests when executing the command.
To specify more than one function,
use multiple --skip flags, or separate the functions with a comma:
atmos describe component <c> -s <stack> --skip=terraform.output --skip=include
atmos describe component <c> -s <stack> --skip=terraform.output,include | | no | | --query | Query the results of the command using yq expressions.

atmos describe component <c> -s <stack> --query .vars.tags

For more details, refer to https://mikefarah.gitbook.io/yq | -q | no | ## Output The command outputs...

(TOO_LONG_SENTENCE)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (57)
examples/quick-start-advanced/Dockerfile (1)

9-9: ATMOS Version Update Confirmed

The update to ARG ATMOS_VERSION=1.158.0 here is consistent with the team's approach to pin to the next future version. This aligns well with previous learnings and ensures that the Dockerfile will install the correct Atmos CLI version as expected.

internal/exec/utils.go (5)

285-286: Good addition of skipping functions functionality
Adding these parameters provides a clear way to toggle YAML function processing and selectively skip certain functions. Ensure nil checks for the skip slice if users do not provide any function names.


534-535: Appropriate assignment after template processing
Saving the processed componentSection ensures that downstream logic sees the updated configuration.


537-539: Consistent usage of new skip parameter
Nicely ties the processYamlFunctions flag to the actual function call with the skip list. This is aligned with the new feature’s requirements.


544-545: Properly storing processed YAML function output
Persisting the updated componentSection is essential after function invocation. This is a clean approach.


547-548: Post-processing triggered by either templates or YAML functions
Conditionally calling postProcessTemplatesAndYamlFunctions covers both code paths effectively.

pkg/describe/describe_component.go (2)

12-13: Expanded function signature
Adding these boolean and slice parameters makes the interface consistent with new skip-based functionality.


15-15: Updated external call
Passing the new parameters into e.ExecuteDescribeComponent cleanly integrates the fresh YAML function logic.

pkg/describe/describe_stacks.go (1)

18-18: Hard-coded parameters
You are passing true for template and function processing and nil for skip. This is fine if the design always calls for full processing. Consider making these parameters flexible if future requirements arise.

pkg/list/list_stacks_test.go (1)

24-25: LGTM! Test coverage updated for new flags.

The test functions have been properly updated to accommodate the new --process-templates and --process-functions flags with appropriate default values.

Also applies to: 41-42

pkg/list/list_components_test.go (1)

24-25: LGTM! Consistent test updates.

The test functions have been updated consistently with list_stacks_test.go to support the new flags.

Also applies to: 44-45

cmd/list_stacks.go (1)

38-38: Add flag definitions for new parameters.

The command implementation has been updated to support the new flags (--process-templates, --process-functions, --skip), but the flag definitions are missing in the init function.

Add the following flag definitions:

 func init() {
 	listStacksCmd.DisableFlagParsing = false
 	listStacksCmd.PersistentFlags().StringP("component", "c", "", "atmos list stacks -c <component>")
+	listStacksCmd.PersistentFlags().Bool("process-templates", true, "Process Go templates in stack manifests")
+	listStacksCmd.PersistentFlags().Bool("process-functions", true, "Process Atmos YAML functions in stack manifests")
+	listStacksCmd.PersistentFlags().StringSlice("skip", nil, "Skip processing specific Atmos YAML functions")
 	listCmd.AddCommand(listStacksCmd)
 }

Also applies to: 53-56

internal/exec/helmfile_generate_varfile.go (1)

42-42: LGTM! ProcessStacks updated consistently.

The ProcessStacks call has been updated to support the new template and function processing flags while maintaining existing functionality.

cmd/list_components.go (1)

44-44: LGTM! Function call updated correctly.

The ExecuteDescribeStacks call has been properly updated to include the new parameters for process functions and skip flags.

internal/exec/terraform_generate_varfile.go (1)

42-42: LGTM! ProcessStacks call updated appropriately.

The function call has been updated with the new parameters, maintaining default behavior by enabling function processing and not skipping any functions.

cmd/describe_component.go (1)

33-34: Well-structured flag additions!

The new flags are well-documented with clear descriptions and examples:

  • process-functions: Enables/disables YAML function processing (default: true)
  • skip: Allows specifying YAML functions to skip during execution

This implementation aligns perfectly with the PR objectives.

pkg/describe/describe_affected_test.go (1)

41-43: Test functions properly updated!

Both test functions have been consistently updated with the new parameters:

  • process-templates: true
  • process-functions: true
  • skip: nil

These changes maintain test coverage for the new functionality.

Also applies to: 75-77

internal/exec/template_funcs_component.go (1)

40-40: Verify the new parameters for ExecuteDescribeComponent.

The function call has been updated to include the new processYamlFunctions and skip parameters. This aligns with the PR objectives to add control over template and function processing.

Run this script to verify the function signature change:

✅ Verification successful

Updated function call parameters are consistent across the codebase.
All call sites for ExecuteDescribeComponent now include the new parameters — passing true, true, nil for processYamlFunctions and skip respectively. This aligns with the PR's intended changes.

  • Confirmed in multiple files (e.g., internal/exec/template_funcs_component.go, pkg/hooks/cmd.go, etc.)
  • Function definition in pkg/describe/describe_component.go reflects the updated signature
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the ExecuteDescribeComponent function signature change
# Expected: Find all calls to ExecuteDescribeComponent to ensure consistent parameter updates

rg -A 2 "ExecuteDescribeComponent\(" 

Length of output: 4330

pkg/component/component_processor.go (1)

32-36: LGTM! Consistent parameter updates for ProcessStacks calls.

Both calls to ProcessStacks have been updated with the new parameters for template and function processing control. The changes maintain consistency between terraform and helmfile component processing.

internal/exec/terraform_generate_backend.go (1)

43-43: LGTM! ProcessStacks call updated with new parameters.

The function call has been updated to include the new parameters for template and function processing control, maintaining consistency with other similar calls in the codebase.

pkg/describe/describe_component_test.go (1)

16-16: LGTM! Test cases updated consistently.

All test cases have been updated to use the new ExecuteDescribeComponent signature with processYamlFunctions and skip parameters. The test coverage remains comprehensive across different component scenarios.

Also applies to: 25-25, 29-29, 38-38, 50-50, 62-62, 74-74, 86-86

pkg/hooks/cmd.go (1)

69-69: LGTM! Function call updated correctly.

The ExecuteDescribeComponent call has been properly updated to include the new parameters for YAML function processing control.

cmd/describe_stacks.go (1)

48-49: LGTM! Well-documented flags added.

The new flags are properly implemented with clear descriptions and helpful usage examples:

  • process-functions: Controls YAML function processing
  • skip: Allows specifying YAML functions to skip

Also applies to: 52-52

internal/exec/describe_component.go (1)

46-49: LGTM! Clean implementation of new parameters.

The changes are well-structured with:

  • Proper error handling for new flags
  • Consistent parameter passing to ProcessStacks
  • Maintained code patterns

Also applies to: 56-59, 63-69, 103-104, 116-116, 119-119

cmd/describe_affected.go (1)

48-50: LGTM! Well-structured flag additions.

The new flags are well-documented and align perfectly with the PR objectives. The default values are sensible, and the descriptions are clear and helpful.

internal/exec/atmos.go (2)

43-44: LGTM! Clear comment and consistent parameter updates.

The comment clarification helps understand why templates and functions aren't processed in this context.


107-107: LGTM! Function call updated consistently.

The ExecuteDescribeComponent call has been properly updated to support the new template and function processing flags.

internal/exec/validate_component.go (1)

85-89: LGTM! Consistent parameter updates across component types.

Both terraform and helmfile component processing have been updated consistently with the new parameters.

internal/exec/aws_eks_update_kubeconfig.go (1)

160-165: LGTM! Consistent parameter updates for EKS configuration.

The ProcessStacks calls have been properly updated for both terraform and helmfile components, maintaining consistency with the new parameter structure.

internal/exec/describe_affected.go (3)

36-38: LGTM! New fields align with PR objectives.

The new fields ProcessTemplates, ProcessYamlFunctions, and Skip are well-placed and properly typed to support the new command-line flags.


165-178: LGTM! Flag parsing follows consistent patterns.

The new flag parsing code maintains consistency with existing patterns and includes proper error handling.


225-227: LGTM! Consistent parameter propagation.

The new parameters are properly propagated to all execution functions, ensuring consistent behavior across different execution paths.

Also applies to: 240-242, 253-255

internal/exec/describe_dependents.go (1)

98-98: LGTM! Function calls updated consistently.

The function calls to ExecuteDescribeStacks and ExecuteDescribeComponent have been properly updated to include the new parameters.

Also applies to: 103-103

internal/exec/helmfile.go (1)

39-39: LGTM! ProcessStacks call updated appropriately.

The ProcessStacks function call has been updated to include the new parameters, maintaining consistency with the updated function signature.

internal/exec/terraform_generate_varfiles.go (1)

272-272: LGTM! ProcessCustomYamlTags call updated.

The ProcessCustomYamlTags function call has been updated to include the new parameter, maintaining consistency with the updated function signature.

internal/exec/terraform_outputs.go (1)

257-257: LGTM! Function call updated with new parameters.

The update to ExecuteDescribeComponent aligns with the new functionality for processing templates and functions.

✅ Verification successful

Consistency Verified: Updated Parameter Usage Confirmed

All instances of the ExecuteDescribeComponent invocation—including in internal/exec/terraform_outputs.go, cmd/cmd_utils.go, internal/exec/atmos.go, and associated test files—consistently call the function with true, true, nil. This aligns with the intended changes to support template and function processing.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent usage of ExecuteDescribeComponent parameters across the codebase
rg -A 2 "ExecuteDescribeComponent\(" | grep -v "func"

Length of output: 3973

internal/exec/terraform_generate_backends.go (1)

263-263: LGTM! Function call updated with new parameter.

The update to ProcessCustomYamlTags maintains consistency with the enhanced YAML processing functionality.

internal/exec/validate_stacks.go (1)

312-312: LGTM! Function call updated with new parameters.

The update to ExecuteDescribeComponent maintains consistency with the new template and function processing capabilities.

internal/exec/terraform.go (1)

117-117: LGTM! Function call updated to support new flags.

The ProcessStacks function call has been updated to include the new parameters for processing templates and functions, aligning with the PR objectives.

cmd/cmd_utils.go (1)

342-342: LGTM! Function call updated consistently.

The ExecuteDescribeComponent function call has been updated to include the new parameters, maintaining consistency with the changes across the codebase.

internal/exec/describe_stacks.go (2)

97-110: LGTM! New flag handling added.

The code correctly retrieves and handles the new process-functions and skip flags, with proper error handling.


404-417: LGTM! YAML function processing implementation.

The code implements the new YAML function processing with proper error handling and skip functionality. The implementation is clean and follows the existing pattern.

internal/exec/describe_affected_utils.go (2)

427-438: LGTM! Function call updated with new parameters.

The ExecuteDescribeStacks function call has been updated to include the new parameters, maintaining consistency with the changes across the codebase.


474-485: LGTM! Consistent parameter handling.

The second instance of the ExecuteDescribeStacks function call is updated consistently with the same parameters, ensuring uniform behavior throughout the code.

website/docs/cli/commands/describe/describe-stacks.mdx (1)

47-50: New Examples for Flag Usage Added

The examples now show clear usage of the new --process-functions and --skip flags. The demonstration of both single and multiple skip values (using repeated flags and comma-separated lists) is consistent with the PR objectives.

go.mod (10)

10-12: AWS SDK Dependencies Updated

The updates to github.com/aws/aws-sdk-go-v2, config, and service/ssm to the newer versions are noted. Please ensure these are fully compatible with your existing code.


21-21: Editorconfig Checker Version Bump

Updating github.com/editorconfig-checker/editorconfig-checker/v3 to v3.2.0 is appropriate. No concerns noted.


33-33: Terraform Config Inspect Update

The new version of github.com/hashicorp/terraform-config-inspect has been bumped appropriately. Make sure any potential breaking changes are addressed.


46-46: OPA Dependency Version Increased

The github.com/open-policy-agent/opa package upgrade to v1.1.0 appears to be a straightforward update. A quick verification of integration would be ideal.


49-49: Samber/lo Updated

The update of github.com/samber/lo to v1.49.1 looks like a minor revision and should be safe.


53-53: SPF13 Pflag Version Update

The new version of github.com/spf13/pflag (v1.0.6) is in keeping with the dependency upgrades. It looks fine.


276-280: OpenTelemetry Dependencies Upgraded

The changes to update go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp to v0.59.0 along with the related OpenTelemetry packages to v1.34.0 have been implemented. Please double-check that these versions remain compatible with your instrumentation and monitoring setups.


293-293: golang.org/x/time Upgrade

The bump to golang.org/x/time v0.9.0 is noted. Running the test suite should confirm that there are no regressions.


298-300: Google Genproto and gRPC Updates

The updates to google.golang.org/genproto/googleapis/api, googleapis/rpc, and google.golang.org/grpc (v1.70.0) appear to be standard version bumps. It is advisable to verify these changes against your gRPC integrations.


258-258: Go-Patricia Update

The update for github.com/tchap/go-patricia/v2 to v2.3.2 is a minor revision and looks acceptable.

website/docs/cli/commands/describe/describe-component.mdx (1)

47-51: Enhanced Examples for Component Command

The new examples clearly display how to disable YAML function processing with --process-functions=false and how to skip specific functions using --skip (via both multiple flags and a comma-separated list). This aligns well with the PR objectives.

website/docs/cli/commands/describe/describe-affected.mdx (1)

111-115: Inclusion of New Flag Examples in Affected Docs

Examples demonstrating the usage of --process-templates, --process-functions, and --skip have been added. These examples help illustrate the enhanced flexibility available with the new flags.

Copy link
Member
@osterman osterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aknysh aknysh merged commit f1c0999 into main Feb 3, 2025
45 checks passed
@aknysh aknysh deleted the add-flag-for-disable-yaml-funcs branch February 3, 2025 19:29
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Feb 3, 2025
Copy link
github-actions bot commented Feb 3, 2025

These changes were released in v1.158.0.

@coderabbitai coderabbitai bot mentioned this pull request Feb 6, 2025
Cerebrovinny pushed a commit that referenced this pull request Feb 9, 2025
…`atmos describe affected`, `atmos describe component` and `atmos describe stacks` commands (#1006)

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0