-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Stacks: run cli arguments #4005
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThis pull request adds new functionality to the stack command. In the CLI command file, new imports and a helper function ( Changes
Sequence Diagram(s)sequenceDiagram
participant U as User Input
participant NC as NewCommand
participant RF as runFlags
participant CMD as CLI Command
U->>NC: Invoke command creation
NC->>RF: Generate flags (combining run & runall)
RF-->>NC: Return combined flags
NC->>CMD: Configure command with flags
sequenceDiagram
participant T as Integration Test
participant TG as Stack Generator
participant TS as Stack Runner
T->>TG: Clean up and set up environment
T->>TG: Execute "terragrunt stack generate"
TG-->>T: Return generated stack
T->>TS: Run "terragrunt stack run apply" with strict inclusion flags
TS-->>T: Return execution output for verification
Possibly related PRs
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
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. 🪧 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: 0
🧹 Nitpick comments (2)
cli/commands/stack/command.go (1)
110-115
: Well-structured function for combining flags from run and runall commands.The
runFlags
function efficiently combines flags from both commands while filtering out potentially conflicting output directory flags. This approach promotes code reuse and maintains consistency across the CLI interface.Consider adding a brief comment explaining why specific flags are filtered out to improve maintainability for future developers.
func runFlags(opts *options.TerragruntOptions) cli.Flags { + // Combine flags from runall and run commands, filtering out output directory flags + // that would conflict with stack command functionality flags := runall.NewFlags(opts, runCommandName, nil).Filter(runall.OutDirFlagName, runall.JSONOutDirFlagName) flags = append(flags, run.NewFlags(opts, nil)...) return flags }test/integration_stacks_test.go (1)
695-714
: Good integration test for the strict inclusion functionality.This test effectively verifies that the
--queue-strict-include
and--queue-include-dir
flags work correctly with the stack command by:
- Only running the command on the specified directory (./.terragrunt-stack/app1)
- Verifying other modules are not processed
- Confirming that dependencies aren't automatically included
The test methodology follows the established patterns in the codebase with proper setup, execution, and assertion steps.
Consider adding a descriptive comment at the beginning of the test function explaining the purpose of testing strict inclusion behavior:
func TestStackApplyStrictInclude(t *testing.T) { + // Test that stack run apply with --queue-strict-include flag only processes + // explicitly included directories and doesn't process dependencies t.Parallel() helpers.CleanupTerraformFolder(t, testFixtureStackDependencies)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cli/commands/stack/command.go
(3 hunks)test/integration_stacks_test.go
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code for quality and correctness. M...
**/*.go
: Review the Go code for quality and correctness. Make sure that the Go code follows best practices, is performant, and is easy to understand and maintain.
cli/commands/stack/command.go
test/integration_stacks_test.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Pull Request has non-contributor approval
🔇 Additional comments (2)
cli/commands/stack/command.go (2)
5-6
: Good addition of necessary imports for integrating run and runall commands.The imports for run and runall commands are necessary for the new functionality being added, allowing the stack command to leverage existing flags from both commands.
55-55
: Good implementation of flags for the run subcommand.Adding the flags to the run subcommand enables proper CLI argument handling, which aligns with the PR objective of enhancing CLI argument handling for the run command.
Description
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Migration Guide
Summary by CodeRabbit
New Features
Tests