Previously the chart source was recorded by mutating the chart's metadata
annotations in pkg/cmd before calling RunWithContext. Because the render
values expose chart metadata to templates (.Chart comes from
accessor.MetadataAsMap()), this injected meta.helm.sh/release-source into
.Chart.Annotations during template rendering, which could change rendered
manifests for charts that enumerate or branch on chart annotations.
Move the annotation to the action layer and apply it only after rendering
completes, via a new Install.ChartSource / Upgrade.ChartSource field. The
annotation lands on the persisted release's chart metadata (the same chart
pointer stored on the release) but is never present in the template render
context, so 'helm list --show-source' and 'helm get metadata' still surface
the source while rendered output is unaffected.
The cmd helper is reduced to a pure chartSource() resolver (repo URL
preferred, credentials stripped); sanitizeChartSource is unchanged. Adds an
action-level test asserting the source is absent from the rendered manifest
but present on the stored release.
Signed-off-by: Shaan Satsangi <shaansatsangi@gmail.com>
The --show-source help claimed JSON/YAML output 'always includes' the
source field, but releaseElement.Source is tagged json:"source,omitempty"
so it is omitted when a release has no recorded source. Reword the help to
state the flag affects only table output and that JSON/YAML emit source
whenever a release has one.
Also add cmd-level get metadata coverage for a release whose chart records
meta.helm.sh/release-source, with table/JSON/YAML golden files, so the new
SOURCE line and source field do not regress.
Signed-off-by: Shaan Satsangi <shaansatsangi@gmail.com>
url.Parse treats a Windows absolute path such as C:\charts\mychart as
having scheme "c", so sanitizeChartSource re-encoded it (e.g. the drive
letter was lowercased and separators could be percent-escaped), producing
a misleading SOURCE value for local installs/upgrades.
Gate sanitization on the parsed URL having a host component, so only real
repository URLs (scheme://host/...) are rewritten while local filesystem
paths and chart references are returned unchanged. Add regression tests
covering Windows (back- and forward-slash) and absolute unix paths.
Signed-off-by: Shaan Satsangi <shaansatsangi@gmail.com>
Record where a release's chart was installed or upgraded from and surface
it via `helm list` and `helm get metadata` — addressing both surfaces
called out in #4256.
`helm install` and `helm upgrade` set a `meta.helm.sh/release-source`
annotation on the chart metadata (the `--repo` URL when supplied,
otherwise the chart reference). The annotation is written after any
`--dependency-update` chart reload so it survives the reload, and any
credentials embedded in a repo URL are stripped before the value is
persisted so secrets are not leaked into the release record.
- `helm list`: new `source` field in JSON/YAML output (omitted when
empty, so existing releases keep their schema) plus an opt-in
`--show-source` flag for the table column, leaving the default table
layout unchanged for scripts that parse it.
- `helm get metadata`: new `source` field, shown in the table only when
set.
Closes#4256
Signed-off-by: Shaan Satsangi <shaansatsangi@gmail.com>
Commands like 'helm registry login', 'helm push', and 'helm pull' were
writing success messages ("Login Succeeded", "Pushed:", "Pulled:",
"Digest:") to stderr instead of stdout. The root cause was that
newDefaultRegistryClient and newRegistryClientWithTLS hard-coded
os.Stderr as the registry client writer, ignoring the out io.Writer
that main() passes as os.Stdout.
Thread out io.Writer through newRegistryClient, newDefaultRegistryClient,
and newRegistryClientWithTLS, and update all call sites in pkg/cmd.
Fixes#13464
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Only user-supplied nils should survive coalescing. Chart-default nils
defaults, not just user overrides. This caused:
- %!s(<nil>) in templates using Bitnami common.secrets.key (#31919)
- pluck fallbacks returning nil instead of falling through to globals
(#31971)
Fixes#31919Fixes#31971
Signed-off-by: Johannes Lohmer <jojo.dev@lohmer.com>
- Clarify --show-rollback flag help text to specify it only affects table output
- Add RollbackRevision JSON round-trip tests for pkg/release/v1 and internal/release/v2
- Add omitempty behavior verification for zero rollback_revision
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
Replace the always-visible ROLLBACK column with an opt-in --show-rollback
flag to avoid breaking the default table output (HIP-0004). JSON and YAML
formats continue to include rollback_revision when present via omitempty.
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>