Skip to content

feat(bundler): bake repoURL default into values.yaml at bundle push t…#1562

Open
mohityadav8 wants to merge 5 commits into
NVIDIA:mainfrom
mohityadav8:feat/1342-bake-repourl-oci
Open

feat(bundler): bake repoURL default into values.yaml at bundle push t…#1562
mohityadav8 wants to merge 5 commits into
NVIDIA:mainfrom
mohityadav8:feat/1342-bake-repourl-oci

Conversation

@mohityadav8

@mohityadav8 mohityadav8 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Bakes the OCI parent namespace as the default repoURL in the argocd-helm bundle's values.yaml at bundle push time.

Motivation

When deploying an argocd-helm bundle, repoURL had no default — every helm install required --set repoURL=oci://.... If omitted, child apps deployed with broken spec.source.repoURL fields.

Fixes

Closes #1342

Implementation Notes

  • Added ParentNamespace() method on oci.Reference — single source of truth, used by both parseBundleCmdOptions and printArgoCDHelmOCIInstructions
  • OCI output: parent namespace baked into values.yaml as repoURL default
  • Local output: repoURL stays "" — existing {{ required }} behaviour unchanged
  • Mirror workflow: operators override with --set repoURL=oci://new-registry

Testing

  • go build ./...
  • go test -race ./pkg/bundler/... ./pkg/cli/...
  • gofmt -w on all changed files ✅

@copy-pr-bot

copy-pr-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change adds OCI parent-namespace plumbing from OCI bundle output parsing through bundler configuration into argocd-helm generation. For OCI outputs, the CLI now derives the parent namespace from the parsed reference and passes it into bundler config. The bundler config exposes that value via a new field, getter, and option. The argocd-helm generator uses it to default root values.yaml repoURL, and a new golden test verifies the baked value.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • NVIDIA/aicr#789: Also changes pkg/cli/bundle.go output-target resolution, overlapping with the OCI reference handling updated in this PR.

Suggested reviewers: lockwobr

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes baking the repoURL default into values.yaml for OCI bundle push flows.
Description check ✅ Passed The description matches the change set and explains the OCI repoURL default behavior and local-path exception.
Linked Issues check ✅ Passed The PR implements the requested OCI repoURL default in generated values.yaml and preserves empty local output behavior.
Out of Scope Changes check ✅ Passed The changes are focused on OCI repoURL default plumbing and tests, with no clear unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 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 `@pkg/bundler/bundler.go`:
- Line 405: The struct literal in the bundler configuration has a formatting
issue: the OCIParentNamespace field is missing the standard space/alignment used
by the other fields, so it will fail gofmt and lint. Update the composite
literal in bundler.go near the config construction so OCIParentNamespace matches
the alignment style used by fields like AppName and the rest of the b.Config
assignments.

In `@pkg/bundler/config/config.go`:
- Around line 468-472: The function bodies for OCIParentNamespace and
WithOCIParentNamespace are indented with spaces instead of tabs, which breaks
gofmt consistency. Update these methods in config.go to match the surrounding
style used by OCISourceName and the rest of the file, keeping the same logic but
using standard gofmt indentation throughout.

In `@pkg/bundler/deployer/argocdhelm/argocdhelm_test.go`:
- Around line 990-1036: Add coverage in TestBundleGolden_OCI_BakesRepoURL for
the local-output path where OCIParentNamespace is unset, since the current test
only verifies the OCI namespace case. Extend the test or add a companion golden
test that runs Generator.Generate with OCIParentNamespace left empty and asserts
values.yaml preserves repoURL: "" instead of baking a namespace. Use the
existing Generator, Generate, and values.yaml assertions to locate the code.
- Around line 990-1036: The TestBundleGolden_OCI_BakesRepoURL body is using
space indentation instead of Go’s standard tab formatting, which will fail gofmt
and lint checks. Reformat the entire function to match the surrounding style in
argocdhelm_test.go, keeping the existing test logic and symbols like
TestBundleGolden_OCI_BakesRepoURL, Generator, and newRecipeResult unchanged.

In `@pkg/bundler/deployer/argocdhelm/argocdhelm.go`:
- Around line 170-175: The file has mixed spaces and tabs in the
OCIParentNamespace doc block and the Generate body, which will fail gofmt.
Reformat the affected comment and the Generate method in argocdhelm.go to use
standard Go tab indentation consistent with the surrounding declarations,
keeping the same symbols (OCIParentNamespace and Generate) but making the
whitespace gofmt-compliant.

In `@pkg/cli/bundle.go`:
- Around line 216-224: The OCI parent-namespace derivation is duplicated between
parseBundleCmdOptions and printArgoCDHelmOCIInstructions, so extract the shared
“registry + repository minus chart segment” logic into a reusable helper. Prefer
adding a method on oci.Reference such as ParentNamespace() next to ChartName(),
then use that helper from both call sites so the baked repoURL default and the
printed helm hint stay consistent.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d5a835a5-3798-4379-9392-7afda06dd056

📥 Commits

Reviewing files that changed from the base of the PR and between 09cb46e and e628021.

📒 Files selected for processing (5)
  • pkg/bundler/bundler.go
  • pkg/bundler/config/config.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/cli/bundle.go

Comment thread pkg/bundler/bundler.go Outdated
Comment thread pkg/bundler/config/config.go
Comment thread pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
Comment thread pkg/bundler/deployer/argocdhelm/argocdhelm.go
Comment thread pkg/cli/bundle.go Outdated
@mohityadav8 mohityadav8 force-pushed the feat/1342-bake-repourl-oci branch from 01969df to 426355a Compare July 1, 2026 08:28
@mohityadav8 mohityadav8 marked this pull request as ready for review July 1, 2026 08:43
@mohityadav8 mohityadav8 requested a review from a team as a code owner July 1, 2026 08:43

@njhensley njhensley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Multi-persona review — bake repoURL default into values.yaml

Method: 4 independent persona reviewers (Correctness · Domain/Architecture · Docs/Contract · CI-DX) → adversarial senior meta-review, each finding re-derived against the resolved code at head cedaaec3. The two blockers were reproduced empirically (go test, gofmt -l).

Tier legend: 🔴 Blocker · 🟠 Major · 🟡 Minor · 🔵 Nitpick

Overall assessment

The core mechanic is sound: ParentNamespace() is a faithful, well-tested extraction of the previously-inlined path.Dir logic (all edge cases verified), the two call sites are now provably consistent, the {{ required }} safety-net correctly stays intact for local output, and the new TestBundleGolden_OCI_BakesRepoURL test is good.

But the PR is not mergeable as-is: it fails both mandatory CI gates (make test and make lint), and it ships a user-facing artifact (the generated bundle README) plus reference docs that now assert the opposite of what the code does.

Recommendation: Request changes (2 blockers, both mechanical). Posted as a neutral COMMENT review per author request.

Findings not attached inline (lines outside the diff)

🟠 Major — Generated README + reference docs now claim the opposite of what the code does
pkg/bundler/deployer/argocdhelm/argocdhelm.go:1181-1183 · docs/user/cli-reference.md:1869
The README emitted into every argocd-helm bundle says "The bundle is URL-portable: the publish location is supplied at install time via --set repoURL=..., not baked into the chart bytes." docs/user/cli-reference.md:1869 says "The publish location is not baked into the bundle artifact." After this PR, for OCI-pushed bundles the parent namespace is baked into values.yaml — both statements are now false, and the PR touches no docs (CLAUDE.md requires docs updated in the same PR).
Scope note: the pure "reproducibility invariant" concern is down-weighted — the artifact was already push-target-dependent via bundleChartName = ociRef.ChartName() (#1019), so digests already varied by registry. The concrete defect is the doc/README contradiction. The --set repoURL= override still works, so deploy-time portability is preserved.
Fix: In this PR, correct the generated-README text and docs/user/cli-reference.md (L1869, the step-3 flow ~L1881-1891, the --repo row L1234) plus the echo in docs/user/bundling.md. Reframe as URL-overridable (baked default + --set override) and advertise the new "plain helm install works, no --set repoURL needed" convenience.

🟡 Minor — Generated values.yaml header self-contradicts the baked value
pkg/bundler/deployer/argocdhelm/argocdhelm.go:470-484
The static header const, printed atop every bundle's values.yaml, declares repoURL a "required install-time input" and lists targetRevision as a surfaced key. For an OCI bundle the file now shows a populated repoURL: oci://… right below that "required" wording, and (per Blocker 1) targetRevision no longer appears in the body — the artifact documents contracts that contradict its own contents.
Fix: Branch/soften the header for OCI bundles ("repoURL — pre-filled with the push-target namespace; override with --set repoURL= to deploy from a mirror"), and keep the targetRevision line only if Blocker 1 is fixed by restoring it.

🔵 Nitpick — Dead constant + stale comment for rootValuesTargetRevisionKey
pkg/bundler/deployer/argocdhelm/argocdhelm.go:126-134
If Blocker 1 is fixed by restoring the targetRevision write, this resolves itself. If the drop is kept, rootValuesTargetRevisionKey becomes unreferenced and the comment ("both keys are surfaced … so helm show values documents them") is false — remove the constant and rewrite the comment for repoURL only.

Confirmed non-issues (examined, cleared)

  • ParentNamespace() correctness — byte-for-byte equivalent to the deleted inline block; verified for single-segment (aicr-bundleoci://reg), multi-segment, deep-nesting, empty Repository"", non-OCI → "". path.Dir never yields a trailing slash, so the template's trimSuffix "/" / hasPrefix "oci://" branches behave correctly.
  • {{ required }} gate — still fails closed for local output (repoURL: "" → install errors as before).
  • CLI plumbingociParentNamespace set only in the OCI branch; local leaves the zero value. WithTag preserves registry/repository.
  • No double-suffix — parent + child templates and bundleChartName all use the same ChartName().
  • verifyBundle — inspects child-App spec.sources, unaffected by the root values.yaml change.
  • pkg/bundler/attestation test failures observed locally (TestNewKeyVerificationIdentity_*) are sigstore TUF network blocks (tuf-repo-cdn.sigstore.dev: Forbidden) — environment, not this PR.

Summary

Tier Count Items
🔴 Blocker 2 Golden tests fail (dropped targetRevision); gofmt violation
🟠 Major 1 Generated README + docs claim "not baked" — now false; docs-in-PR rule
🟡 Minor 2 Self-contradicting values.yaml header; redundant --set repoURL hint
🔵 Nitpick 1 Dead rootValuesTargetRevisionKey const + stale comment

The two blockers are one-command fixes (restore one line + gofmt -w); the Major is a same-PR doc sweep. The underlying feature logic is correct.

Reviewed with a multi-persona + adversarial meta-review workflow. Inline comments below anchor the two blockers and the redundant-hint minor to the diff.

// work without --set flags. For local output, OCIParentNamespace is "" and
// the {{ required }} safety-net is unchanged. See #1342.
repoURLDefault := g.OCIParentNamespace
dynamicOnlyValues[rootValuesRepoURLKey] = repoURLDefault

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocker — Golden tests fail: the targetRevision default was silently dropped

This block replaced two lines with one — it kept the repoURL write but deleted dynamicOnlyValues[rootValuesTargetRevisionKey] = "". That was the only writer of targetRevision into the root values.yaml, so the key now vanishes from generated output. The golden fixtures testdata/helm_and_manifest_only/values.yaml and testdata/mixed_component/values.yaml still contain the trailing targetRevision: "" line.

Blast radius: Reproduced: go test ./pkg/bundler/deployer/argocdhelm/... → FAIL: TestBundleGolden_HelmAndManifestOnly, FAIL: TestBundleGolden_MixedComponent (byte-diff = the missing targetRevision: "" line). make test / make qualify go red; the PR cannot merge. The PR description's "tests pass" claim does not hold.

Fix: Restore the line rather than regenerate goldens. Dropping targetRevision looks unintentional and regresses the explicit intent of #1020 ("surface both keys so helm show values documents them"). Re-adding dynamicOnlyValues[rootValuesTargetRevisionKey] = "" makes the goldens pass unchanged and keeps the values.yaml header (which still documents targetRevision) consistent. If the drop IS intentional, regenerate goldens with -update AND also fix the stale header (line 470-484) and the now-dead rootValuesTargetRevisionKey constant (line 126-134).

Comment thread pkg/bundler/bundler.go Outdated
Comment thread pkg/cli/bundle.go
@mohityadav8 mohityadav8 force-pushed the feat/1342-bake-repourl-oci branch from 0986d84 to 5b64a39 Compare July 1, 2026 19:59
@mohityadav8 mohityadav8 requested a review from njhensley July 1, 2026 20:09
@mohityadav8

Copy link
Copy Markdown
Contributor Author

@njhensley done

@mohityadav8 mohityadav8 force-pushed the feat/1342-bake-repourl-oci branch from 2cc7af8 to 92dd63d Compare July 2, 2026 09:56
@mohityadav8 mohityadav8 force-pushed the feat/1342-bake-repourl-oci branch from 92dd63d to 4c6f48c Compare July 2, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bundler): bake repoURL default into values.yaml at bundle push time (argocd-helm deployer)

2 participants