fix(bundler): stop dry-run previewing a stale cached chart archive - #2855
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository: NVIDIA/aicr/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA/aicr/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. 📝 WalkthroughWalkthroughThe Helm template and generated install scripts now reuse Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
1fd1068 to
c0166a6
Compare
Recipe evidence checkNo leaf overlays affected by this PR. This gate is warning-only and never blocks merge. |
Coverage Report ✅
Coverage BadgeNo Go source files changed in this PR. |
dd718ea to
3e8ffd7
Compare
apply-crds.sh is the only thing that writes .aicr-chart.tgz, and it is skipped under --dry-run so the cluster is not touched. The install script still selected that archive on existence alone, so a dry run previewed bytes left by an earlier real deploy rather than what the next real run would fetch. The reuse branch also clears CHART_VERSION_ARGS and REPO, so the preview silently dropped --version as well. Gate the reuse on the same DRY_RUN_FLAG condition that gates the pull. install-local-helm.sh.tmpl has no equivalent branch; it installs from the vendored chart directory, so only the upstream template is affected. Signed-off-by: Brian Lockwood <lockwobr@gmail.com>
3e8ffd7 to
982d560
Compare
NVIDIA#2855 added the dry-run stale-archive guard to install-upstream-helm.sh.tmpl after this branch captured its golden, so TestBundleGolden_ReadinessGate compared freshly generated output against the pre-NVIDIA#2855 install.sh and failed. Regenerated with -update; the only file that moves is testdata/readiness_gate/001-foo/install.sh, which now carries the same DRY_RUN_FLAG guard and comment the other helm goldens already have. No production code changes. Signed-off-by: Eron Wright <eronwright@gmail.com>
Summary
Gate the cached-chart reuse branch in
install-upstream-helm.sh.tmplonDRY_RUN_FLAG, so a dry run previews the chart the next real run will fetch instead of an archive left behind by an earlier deploy.Motivation / Context
apply-crds.shpulls the pinned chart once and leaves it at.aicr-chart.tgz, andinstall.shinstalls from that exact file so both phases are bound to one artifact. That part is deliberate: re-resolvingCHART/VERSIONwould be a second fetch that a mutable tag does not promise returns the same bytes.But
apply-crds.shis skipped under--dry-run, because a dry run must not touch the cluster:while the reuse branch below it was unconditional:
So on a dry run no pull happens, and any archive on disk is by definition left over from a previous real deploy. If the pin has moved since, the preview shows the wrong chart. Worse than the ticket describes: the reuse branch also clears
CHART_VERSION_ARGSandREPO, so the previewed command silently loses--versiontoo. A dry run is the one operation whose entire purpose is to tell you what is about to happen.Fixes: #2842
Related: #2853 (touches the same template; expect a golden conflict on whichever lands second)
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component/*)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)Implementation Notes
One condition, matching the one that already gates the pull, so the two halves of the handoff agree about when an archive exists.
install-local-helm.sh.tmplwas checked and has no equivalent branch: it installs from the vendored chart directory and never consults.aicr-chart.tgz, so the upstream template is the only one affected.Note this was not closed by the private-
mktemp -drework that landed in #2725. That hardened which archive the pull selects; this is about the install trusting a file the current invocation never produced.Testing
All pass; linter reports 0 issues.
The regression renders a bundle, plants a
.aicr-chart.tgz, runsinstall.shwithDRY_RUN_FLAG=--dry-rununder a stubhelmthat records argv, and asserts the upgrade resolved the pinned coordinates. It asserts positively on both the chart ref and--version, not merely on the absence of the archive path, because dropping--versionis the second symptom. It also fails if the upgrade call was never reached, so it cannot pass vacuously.Mutation-verified. Reverting the guard reproduces the defect exactly:
Note the absent
--versionin that output: both symptoms in one line.Risk Assessment
One shell condition. Real installs are unaffected, since
DRY_RUN_FLAGis empty there and the branch behaves exactly as before. The only behavior that changes is the dry run, which now resolvesCHART/VERSIONthe way the subsequent real run will.Rollout notes: N/A.
Checklist
make testwith-race)make lint)git commit -S)