fix(helm): skip Helm's OCI registry progress messages on stdout (#1223) (#1247)

* fix(helm): skip OCI registry progress messages on stdout

Helm 4.2.1 moved the registry client's progress messages from stderr to
stdout (helm/helm#32056), so on an OCI reference they now precede the real
output. helm parses the stdout of `helm show chart` and helm_template
returns the stdout of `helm template`, and neither can detect this from the
return code because both commands exit 0.

Helm rewrites '+' to '_' in OCI tags, which makes it also print a free-text
explanation. That is not valid YAML, so a chart version carrying semver
build metadata failed outright. Without the '+' the messages parse as a
mapping instead, silently adding Pulled/Digest keys to the chart info.

Match helm's message verbatim rather than seeking the start of the real
output: the payload has three shapes and can be empty, whereas the messages
are always at the front and byte-identical. A reworded message then fails
loudly instead of consuming a line of real output.

Fixes: #1222

* test(helm): cover OCI charts whose version has build metadata

Pushes a chart versioned 1.0.0+build.1 to the local registry and asserts
that helm installs it idempotently with the version reported verbatim, and
that helm_template returns only rendered manifests. A second version without
build metadata covers the case where the registry messages parse as YAML.

Pinned to Helm 4.2.4: the target is only meaningful on >= 4.2.1, which is
where the messages moved to stdout. The rest of the helm matrix tops out at
v4.0.0, which is why this went unnoticed.

Verified to fail on the parent commit and pass on the fix.

* test(helm): drop Go template from chart fixture

The yamllint sanity test parses chart templates with libyaml, where
`{{ default "test" .Values.myValue }}` is an unhashable mapping key. The
existing chart fixtures carry a yamllint!skip entry in every
tests/sanity/ignore-*.txt for exactly this, but the target never renders
the chart with values, so the template served no purpose. Making the
fixture plain YAML keeps the ignore lists from growing.

* test(ci): empty commit to re-trigger CI

(cherry picked from commit c098ecc8c8)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
This commit is contained in:
patchback[bot]
2026-09-14 14:33:17 +01:00
committed by GitHub
co-authored by Yuriy Novostavskiy
parent e620b92b49
commit b40a401ec2
11 changed files with 364 additions and 1 deletions
+2 -1
View File
@@ -523,6 +523,7 @@ from ansible.module_utils.basic import missing_required_lib
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
AnsibleHelmModule,
parse_helm_plugin_list,
strip_registry_progress,
)
from ansible_collections.kubernetes.core.plugins.module_utils.helm_args_common import (
HELM_AUTH_ARG_SPEC,
@@ -613,7 +614,7 @@ def fetch_chart_info(
rc, out, err = module.run_helm_command(inspect_command)
return yaml.safe_load(out)
return yaml.safe_load(strip_registry_progress(out))
def deploy(