Skip to content

fix(bundler): argocd-helm repoURL UX — surface key, emit install hint#1081

Merged
mchmarny merged 1 commit into
mainfrom
fix/argocd-helm-repourl-ux
May 28, 2026
Merged

fix(bundler): argocd-helm repoURL UX — surface key, emit install hint#1081
mchmarny merged 1 commit into
mainfrom
fix/argocd-helm-repourl-ux

Conversation

@mchmarny

Copy link
Copy Markdown
Member

Summary

Close the two actionable observations from #1020: surface repoURL and targetRevision in the argocd-helm bundle's root values.yaml (so helm show values documents them), and print the canonical helm install line at the end of an OCI push so contributors don't have to derive it from the {{ required }} error message.

Motivation / Context

#1020 originally listed four UX gaps on argocd-helm OCI publishes. The issue's status refresh (2026-05-28) closed two of them:

  • "Bake repoURL into chart at build time" — wontfix-by-design. The bundle is URL-portable per the publish-once / mirror-many constraint (pkg/cli/bundle.go:175-184, argocdhelm.go:606-614). Baking the publish URL breaks that.
  • "Fail at bundle time" — incompatible with the portability design.

The two remaining gaps — both documentation-shaped — are what this PR fixes.

Fixes: #1020

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Component(s) Affected

  • Bundlers (pkg/bundler, pkg/component/*)
  • CLI (cmd/aicr, pkg/cli)

Implementation Notes

values.yaml surfacing (pkg/bundler/deployer/argocdhelm/argocdhelm.go)

argocdhelm.Generate now writes the bundle's root values.yaml via a new writeRootValuesFile helper that:

  • Prepends an "Install-time inputs (required for argocd-helm bundles)" doc header explaining repoURL and targetRevision, with example --set lines.
  • Injects both keys with empty-string defaults so helm show values lists them.

The parent App template's {{ required }} directive at argocdhelm.go:479, 811 still enforces non-empty at render time — the empty defaults only affect documentation surface, not runtime behavior. The header wording matches the post-#1051 native-OCI contract: repoURL is the parent namespace, no chart name, because the parent App template appends .Chart.Name itself.

OCI install hint (pkg/cli/bundle.go)

runBundleCmd now calls a new printArgoCDHelmOCIInstructions after a successful OCI push when --deployer argocd-helm. Output:

argocd-helm bundle pushed: oci://<registry>/<repository>:<tag>

To install:
  helm install <release> oci://<registry>/<repository>:<tag> \
    --namespace argocd \
    --set repoURL=oci://<registry>/<parent-path>

Parent-path derivation uses path.Dir(Repository); the helper degrades gracefully to a registry-only repoURL when Repository is a single segment (path.Dir → "."). Skips silently for nil or non-OCI references.

Scope deliberately limited to argocd-helm

Other deployers' OCI publishes don't ship a Helm chart — they're generic AICR artifacts with their own distribution path. Emitting a helm install line for them would be wrong; the existing --image-refs digest file is the canonical post-push artifact for those flows.

Testing

make qualify  # green: lint, race, e2e chainsaw (22 tests), grype, licenses
go test -race ./pkg/cli/... ./pkg/bundler/deployer/argocdhelm/...
golangci-lint run -c .golangci.yaml ./pkg/cli/... ./pkg/bundler/deployer/argocdhelm/...

New TestPrintArgoCDHelmOCIInstructions covers four shapes:

  • nested namespace (oci://ghcr.io/nvidia/aicr-bundle:v1.0.0)
  • deeply nested (registry.example.com/team/platform/aicr-bundle:0.42.0)
  • single-segment repo (parent collapses to registry-only repoURL)
  • nil / non-OCI ref (silent skip)

Includes an assertion that the --set repoURL= line never contains the chart-name segment — pins the post-#1051 contract against future refactors that might reintroduce double-append.

argocdhelm goldens were regenerated via go test ./pkg/bundler/deployer/argocdhelm/... -run TestBundleGolden -args -update. Two golden values.yaml files (helm_and_manifest_only/, mixed_component/) now ship with the new header + the two surfaced keys.

Coverage delta (pkg/cli, pkg/bundler/deployer/argocdhelm): both packages pass the project-wide 70% floor; per-package coverage on pkg/cli improved (new printArgoCDHelmOCIInstructions is fully exercised by the new test).

Risk Assessment

  • Low — Documentation-shaped change. The required template directive still gates render-time non-empty; nothing about the runtime contract changes. Existing bundles continue to install identically. New bundles ship a more verbose values.yaml (additional 14 lines of comments + 2 empty-string keys) and OCI publishes emit one block of stdout per push.

Rollout notes: None. No migration. No flag flips. Consumers who scrape values.yaml via helm show values will start seeing two new keys and a documentation header — that's the intended outcome.

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed — N/A (CLI reference already covers --set repoURL semantics at docs/user/cli-reference.md:1592-1600; the contract didn't change)
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

Closes the two actionable observations from #1020 (the other two were
closed during the issue's status refresh: "bake repoURL into chart" was
wontfix-by-design — bundles are URL-portable per the publish-once /
mirror-many constraint, and "fail at bundle time" is incompatible with
that same design).

## values.yaml surfacing

argocdhelm.Generate now writes the bundle's root values.yaml through a
new writeRootValuesFile helper that prepends an "Install-time inputs"
header explaining repoURL and targetRevision, and injects both keys
with empty-string defaults. The parent App template's {{ required }}
directive still enforces non-empty at render time — empty defaults
only affect documentation surface (helm show values now lists the
keys; before, they were invisible).

The doc header wording reflects the post-#1051 native-OCI contract:
repoURL is the PARENT namespace, no chart name, because the parent
App template appends .Chart.Name itself.

## OCI install hint

runBundleCmd now calls printArgoCDHelmOCIInstructions after a
successful OCI push when --deployer argocd-helm. The helper formats:

  argocd-helm bundle pushed: oci://<reg>/<repo>:<tag>

  To install:
    helm install <release> oci://<reg>/<repo>:<tag> \
      --namespace argocd \
      --set repoURL=oci://<reg>/<parent-path>

Parent-path derivation uses path.Dir(Repository); the helper degrades
gracefully to a registry-only repoURL when Repository is a single
segment (path.Dir → "."). Skips silently for non-OCI references.

## Scoped to argocd-helm intentionally

Other deployers' OCI publishes don't ship a Helm chart — they're
generic AICR artifacts with their own distribution path. Emitting a
helm install line for them would be wrong; the existing
--image-refs digest file is the canonical post-push artifact for
those flows.

## Testing

- New TestPrintArgoCDHelmOCIInstructions covers four shapes: nested
  namespace, deeply nested, single-segment (parent collapses to
  registry), nil/non-OCI (silent skip). Includes an assertion that
  the --set repoURL line never contains the chart name segment, to
  pin the post-#1051 contract against future refactors that might
  reintroduce double-append.
- argocdhelm goldens regenerated via go test -args -update; both
  testdata/helm_and_manifest_only/values.yaml and
  testdata/mixed_component/values.yaml now ship with the new header
  + repoURL/targetRevision keys.
- make qualify clean: lint, race, e2e chainsaw (22 tests), grype,
  license headers.

Fixes #1020
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Actionable comments posted: 0

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 7714cdf1-0f59-4a49-9e53-6005cbea1a4d

📥 Commits

Reviewing files that changed from the base of the PR and between d9247c8 and 9933e26.

📒 Files selected for processing (5)
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/values.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/mixed_component/values.yaml
  • pkg/cli/bundle.go
  • pkg/cli/bundle_test.go

📝 Walkthrough

Walkthrough

This PR addresses issue #1020 by improving the UX of argocd-helm OCI bundles. It documents repoURL and targetRevision as required install-time inputs in the generated values.yaml with empty defaults and a documentation header, allowing helm show values to list them. The bundler now writes these keys with deterministic YAML marshaling. When publishing OCI bundles via the CLI, the PR adds a new helper that derives the parent repository URL by stripping the chart-name path segment and prints canonical helm install commands with --set repoURL=<parent> for user convenience, along with comprehensive test coverage for multiple OCI reference shapes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • NVIDIA/aicr#1047: Both PRs adjust how the parent repoURL is derived for argocd-helm OCI bundles to avoid an extra path segment being appended.
  • NVIDIA/aicr#1039: Both PRs center on the repoURL contract for argocd-helm and ensure mixed-component -pre/-post children resolve without double-suffixed OCI repoURL values.
  • NVIDIA/aicr#1048: Both PRs adjust Argo CD OCI repoURL/path derivation rules for OCI reference shape handling.

Suggested labels

size/M

Suggested reviewers

  • lockwobr
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: surfacing repoURL key and emitting install instructions for argocd-helm bundles.
Description check ✅ Passed The description comprehensively explains the changes, motivation, implementation details, testing approach, and risk assessment related to the changeset.
Linked Issues check ✅ Passed The PR successfully addresses both primary objectives from issue #1020: surfacing repoURL/targetRevision in values.yaml and printing canonical helm install instructions for OCI bundles.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the argocd-helm deployer UX improvements specified in issue #1020; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/argocd-helm-repourl-ux

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

@mchmarny mchmarny enabled auto-merge (squash) May 28, 2026 12:44
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report ✅

Metric Value
Coverage 77.1%
Threshold 75%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-77.1%25-green)

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/aicr/pkg/bundler/deployer/argocdhelm 81.79% (-0.02%) 👎
github.com/NVIDIA/aicr/pkg/cli 65.44% (+0.23%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/aicr/pkg/bundler/deployer/argocdhelm/argocdhelm.go 81.79% (-0.02%) 390 (+16) 319 (+13) 71 (+3) 👎
github.com/NVIDIA/aicr/pkg/cli/bundle.go 50.55% (+3.24%) 182 (+15) 92 (+13) 90 (+2) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@mchmarny mchmarny merged commit b05fc2e into main May 28, 2026
33 of 35 checks passed
@mchmarny mchmarny deleted the fix/argocd-helm-repourl-ux branch May 28, 2026 12:53
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.

bug(bundler): argocd-helm repoURL UX — surface in values.yaml and emit OCI install hint

2 participants