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>
Three test cases that cover the regression scenarios introduced
by the #31644 nil preservation fix:
- subchart default nils should be cleaned up
when parent doesn't set those keys (#31919)
- user-supplied null should erase subchart defaults (#31919)
- subchart default nil should not shadow global values via pluck (#31971)
Tests are expected to fail until the regression is fixed.
Signed-off-by: Johannes Lohmer <jojo.dev@lohmer.com>
When running 'helm pull --debug', no debug output was printed because
the HTTP getter did not emit any slog.Debug messages. This adds
slog.Debug calls to log the URL being fetched and the response status
when debug-level logging is enabled.
Fixeshelm/helm#31098
Signed-off-by: Cairon <cairon-ab@users.noreply.github.com>
Move implementation to pkg/kubeenv per review; kube.RetryingRoundTripper
remains a type alias for API compatibility. pkg/cli uses kubeenv only.
Signed-off-by: Sumit Solanki <sumit.solanki@ibm.com>
The previous fix (increasing timeout / reducing deletion delay) did not
work because the flakiness is not a timing problem at all.
Root cause: fluxcd/cli-utils HasSynced() returns true after the initial
list item is *popped* from DeltaFIFO, which is before AddFunc delivers
the ResourceUpdateEvent to the collector. This creates a race where the
SyncEvent can arrive at the statusObserver *before* the pod's Current
status is recorded. When that happens:
- statusObserver sees pod as Unknown
- Unknown is skipped for WaitForDelete (by design, to handle resources
that were already deleted before watching started)
- AggregateStatus([], NotFoundStatus) == NotFoundStatus → cancel()
- The watch context is cancelled before DeleteFunc can fire
- Final check: pod still Current → error
The test intent is to verify that waitForDeleteCtx (not the cancelled
generalCtx) is selected. A non-existent resource satisfies this:
- With waitForDeleteCtx=Background(): informer syncs with empty list
→ Unknown → cancel → success ✓
- With generalCtx (cancelled, wrong): context immediately done
→ ctx.Err() appended → error returned ✓
Remove the goroutine-based deletion and the pod creation to eliminate
the race while preserving the context-selection assertion.
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
TestMethodContextOverridesGeneralContext/WaitForDelete used a 1s
timeout with a 500ms deletion delay, leaving only ~500ms for the
fake watcher to propagate the delete event. On loaded CI runners
this window is too tight and causes intermittent failures.
Increase the timeout to 5s and reduce the deletion delay to 100ms
so there is ample headroom. Apply the same deletion-delay reduction
to TestStatusWaitForDelete which shares the same pattern.
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
- root.go: guard against nil writer in newRegistryClient variadic
parameter to prevent panic on explicit nil pass
- push.go (cmd): replace io.Discard with suppressSummaryWriter that
forwards warnings/errors to stderr while silently dropping the
registry client's built-in "Pushed:"/"Digest:" summary lines
- push.go (action): return a clear error when Run() is called on an
OCI remote without WithPushConfig, preventing nil-pointer panic on
p.cfg.RegistryClient dereference
Signed-off-by: Ilya Kislitsyn <kis-ilya-a@yandex.ru>
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>
Add an optional io.Writer parameter to newRegistryClient (and the
internal newDefaultRegistryClient / newRegistryClientWithTLS helpers)
so callers can control where registry client output goes.
All existing callers are unaffected (default remains os.Stderr).
For helm push, pass io.Discard so that the registry client's built-in
"Pushed:"/"Digest:" lines are suppressed. The --output writer
(WriteTable / WriteJSON / WriteYAML) is the single source of truth for
push result output, preventing duplication on the terminal.
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>
Address Copilot review feedback:
- WriteTable now uses "Pushed:"/"Digest:" labels consistent with the
registry client's built-in output (pkg/registry/client.go:746-747),
so the default --output table experience is familiar to existing users
- Add TestPushOutputFlagCompletion to verify the --output flag is
properly registered and offers json/yaml/table completions
- Document that Pusher.Push and action.Push.Run signature changes are
intentional breaking changes in the Helm v4 major release
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>
cmd/push: implement WriteTable to emit ref and digest
The WithPushOptWriter option and the out field on Push were never
wired to any meaningful output path — ChartUploader.Out is not read
by UploadTo() and the registry client manages its own writer.
Remove them to avoid dead API surface.
WriteTable now writes a tab-aligned REF/DIGEST result to the
command's stdout stream. The registry client continues to write
its own progress output to stderr, so there is no duplication.
Signed-off-by: Mentigen <mentigen@mentigen.ru>
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>
Add support for --output flag to 'helm push' command for machine-readable
output formats (JSON and YAML). This enables programmatic consumption of push
results and integration with tools like cosign for artifact signing.
Changes:
- Modified Pusher interface to return (*registry.PushResult, error)
- Updated OCIPusher.Push() and push() to return PushResult
- Updated action.Push.Run() to return (*registry.PushResult, error)
- Added output formatting to push command (table/json/yaml)
- Created pushResult struct with Ref and Digest fields
- Implemented pushWriter with WriteTable/WriteJSON/WriteYAML methods
- Updated test fixtures to handle new return signature
The default table format maintains backward compatibility with existing
plain-text output style.
Fixes#11735
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>
When Deployed() succeeds but releaserToV1Release() fails, prepareUpgrade
returned err (nil) instead of cerr (the conversion error), causing a
silent nil return that could lead to nil pointer dereferences downstream.
Closes#32007
Signed-off-by: Rhys McNeill <rhysmcneill7@hotmail.co.uk>
Move the retrying HTTP round-tripper used by EnvSettings into pkg/cli so
pkg/cli no longer imports pkg/kube, avoiding import cycles for Helm
library consumers while preserving retry behavior for transient API
server errors.
Add pkg/cli/roundtripper_test.go with parity coverage for the moved logic.
Signed-off-by: Sumit Solanki <sumit.solanki@ibm.com>
Made-with: Cursor
Move the retrying round tripper used by EnvSettings into pkg/cli so
pkg/cli no longer imports pkg/kube. This preserves retry behavior while
breaking the import edge that triggers cycles for Helm library consumers
(such as the kustomize integration described in #31965).
Signed-off-by: Sumit Solanki <sumit.solanki@ibm.com>
The toTOML doc comment said "returns empty string on marshal error"
but the implementation actually returns err.Error(). Fix the comment
to match the real behavior. Also mention mustToToml as the strict
alternative.
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>
Add `mustToToml` that panics on marshal error, consistent with
`mustToYaml` and `mustToJson`. This makes it possible for chart authors
to get a hard failure when TOML serialization fails, rather than having
to inspect the output manually.
`toToml` behavior is unchanged in this commit.
Closes#31430
Signed-off-by: Ilya Kiselev <kis-ilya-a@yandex.ru>