refactor: update recipe config accessors#279
Conversation
…for AWS, Azure, and GCP
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughIntroduce a namespaced Recipe config API, migrate AWS/Azure/GCP provider recipes to cloud-scoped namespaces, centralize Pulumi stack config generation into cd/config.go, update cd_main to use JSON stack config, and add tests validating parsing, env-driven config, and Automation API behavior. ChangesConfiguration Namespace Refactoring & CD config consolidation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@provider/defangaws/aws/recipe.go`:
- Around line 5-30: The recipe currently reads AWS settings (e.g.,
DeletionProtection, BackupRetentionDays, LogRetentionDays) only from defang-aws
which silently falls back to defaults; update these accessors so they first try
the defang-aws key and if missing check the legacy defang namespace (e.g., read
defang:deletion-protection when recipe.Bool("deletion-protection") is absent)
before applying the default. Modify the logic around the recipe variable created
by common.NewRecipe("defang-aws") to perform a fallback lookup for the specific
symbols DeletionProtection, BackupRetentionDays, LogRetentionDays (and any other
AWS-related flags like AllowOverwriteRecords/RetainDnsOnDelete) by querying the
legacy key and returning that value when present, or else the existing default.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d7b72592-9a5e-4c4b-b763-0692526dae7d
📒 Files selected for processing (8)
cd/program/project_pb.goprovider/common/recipe.goprovider/defangaws/aws/infra.goprovider/defangaws/aws/lb.goprovider/defangaws/aws/recipe.goprovider/defangazure/azure/recipe.goprovider/defangazure/project.goprovider/defanggcp/gcp/recipe.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cd/config.go`:
- Around line 141-163: In addStackConfigFromEnv, avoid overwriting
recipe-provided values and false-positive errors by first checking config for
existing keys: when setting keys like "defang:cdImage", "defang:etag",
"defang:org", "defang:stateUrl" and "defang:provider" only write into config if
the corresponding env var is non-empty OR the config map does not already
contain that key; likewise, when validating the provider (the logic that
currently errors if no provider env var is present), first consult
config["defang:provider"] and only error if neither the env var nor an existing
config entry exist. Use the function name addStackConfigFromEnv, the config map
and configValue struct to locate where to apply these conditional writes and the
provider validation to fix.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8901c8a2-6500-4d1e-b68c-19d987607ad8
📒 Files selected for processing (6)
cd/cd_main.gocd/cd_main_integration_test.gocd/cd_main_test.gocd/config.gocd/config_test.gocd/main_test.go
💤 Files with no reviewable changes (1)
- cd/cd_main_test.go
✅ Files skipped from review due to trivial changes (1)
- cd/main_test.go
Update recipe config accessors to use namespaced accessors for AWS, Azure, and GCP.
This means recipes use provider specific keys, ie.
defang-aws,defang-gcp,defang-azurewhich is how all other providers manage their config.Summary by CodeRabbit