- Add per-chartDir mutex via getNamedRWMutex to prevent concurrent
releases referencing the same local chart from racing on helm dep
build writes (same pattern as forcedDownloadChart for #768).
- Log non-lock errors at Warnf instead of Debugf so users can diagnose
why strategicMergePatches fail with "no resource matches".
- Document why --skip-refresh is kept (file://-only deps are the common
case; chartify runs dep build without --skip-refresh afterwards and
catches stale repos for mixed-dep subcharts).
- Use strings.HasPrefix instead of manual slicing in test helper.
Signed-off-by: yxxhero <aiopsclub@163.com>
Helm's `dependency build` on the parent chart fetches each file:// subchart
and packages it as .tgz, but does NOT recursively build the subchart's own
dependencies first. For envelope charts whose subcharts declare their own
local file:// dependencies, the resulting .tgz lacks the nested subchart's
resources. chartify's `helm template` then silently drops those resources,
and strategicMergePatches/jsonPatches targeting them fail with
"no resource matches".
Fix: add `preBuildTransitiveSubchartDeps`, called from processChartification
before chartify runs (gated on !skipDeps). It walks the transitive file://
dependency tree depth-first and runs `helm dependency build` bottom-up on each
subchart source directory, so each subchart's deps are pre-built before the
parent packages them. The function is best-effort: errors are logged at debug
level and do not abort the operation, matching helmfile's existing behavior
of tolerating already-built deps.
Verified with a reproduction case that fails before the fix
(`Error: no resource matches strategic merge patch ".../nested-sm.[noNs]"`)
and passes after it.
Resolves#851
Signed-off-by: yxxhero <aiopsclub@163.com>