Repository navigation
fix(hooks): resolve $ATMOS_COMPONENT_PATH via metadata.component for non-JIT components - #2805
Andriy Knysh (aknysh) wants to merge 3 commits into
Conversation
…non-JIT components For a component aliasing another local component folder via metadata.component, hook kinds consuming $ATMOS_COMPONENT_PATH (infracost, trivy, checkov, kics, tflint, command) resolved the path from the raw stack-facing component name and scanned a directory that does not exist. GetHooks now backfills the resolved Terraform component from the describe output it already fetches, so componentPathFor's non-workdir fallback joins the metadata.component target. Fixes #2799 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesHook path enrichment
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GetHooks
participant ExecuteDescribeComponent
participant enrichInfoFromDescribe
participant componentPathFor
GetHooks->>ExecuteDescribeComponent: Describe component
ExecuteDescribeComponent-->>GetHooks: Resolved component sections
GetHooks->>enrichInfoFromDescribe: Enrich execution info
enrichInfoFromDescribe-->>GetHooks: Component path metadata
GetHooks->>componentPathFor: Resolve hook scan path
componentPathFor-->>GetHooks: Metadata component directory
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Resource Changes Found for
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2805 +/- ##
=======================================
Coverage 81.80% 81.80%
=======================================
Files 1793 1793
Lines 173037 173048 +11
=======================================
+ Hits 141545 141567 +22
+ Misses 23686 23675 -11
Partials 7806 7806
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Closing in favor of #2802, which fully subsumes this fix: it resolves |
what
$ATMOS_COMPONENT_PATHresolution in lifecycle hooks for plain (non-JIT) components that point at a different local component folder viametadata.component.GetHooksnow backfills the resolved Terraform component (FinalComponent, andComponentFolderPrefixfor subpath values likeshared/nat-gateway) onto the hook context from theExecuteDescribeComponentoutput it already fetches — no extra describe call.infracosthook) and a table-driven unit test for the backfill logic.docs/fixes/2026-07-25-hooks-component-path-metadata-component.md.why
prepareHookContext→ProcessCommandLineArgs) and never runs stack processing, soFinalComponentwas empty formetadata.component-aliased components. The path fallback incomponentPathForthen joined the raw stack-facing component name (e.g.nat-gateway-alias) onto the components directory — a folder that never exists for an alias.$ATMOS_COMPONENT_PATH(infracost,trivy,checkov,kics,tflint, andkind: commandhooks referencing it) therefore scanned a nonexistent directory. Forkind: infracostthe failure was silent: infracost exits 0 with "Could not autodetect any projects" and reports$0.00, indistinguishable from a genuinely cost-free component.FinalComponent(e.g. the CI hook path inpkg/ci/plugins/terraform/handlers.go) are never overwritten, and the JIT-workdir resolution branch (thesource.urifamily of fixes from fix(jit): honor metadata.component subpath for JIT source-provisioned components #2371 / fix: Use atmos_component for source provisioner workdir paths #2137 / fix: respect workdir path for generate: writes and hook-triggered terraform #2309 / Bug: CI planfile upload silently skipped for auto-provisioned (.workdir) components — upload path resolved from source dir, not working dir #2684) still takes precedence when a provisioned workdir exists.references
source.uricode path: JIT/workdir-provisioned components ignore metadata.component subpath #2364 / fix(jit): honor metadata.component subpath for JIT source-provisioned components #2371, JIT vendoring (source pull) writes to a different workdir thanterraform plan/initwhenmetadata.componentdiffers from the component instance name #2134 / fix: Use atmos_component for source provisioner workdir paths #2137, fix: respect workdir path for generate: writes and hook-triggered terraform #2309 (Bug 2), Bug: CI planfile upload silently skipped for auto-provisioned (.workdir) components — upload path resolved from source dir, not working dir #2684 — this PR covers the plain/localmetadata.componentbranch they didn't reach.Summary by CodeRabbit
metadata.component.