From ae90b60fd67e78120cefd93ceae2939cec0a607d Mon Sep 17 00:00:00 2001 From: Yuriy Novostavskiy Date: Thu, 25 Jun 2026 20:19:14 +0200 Subject: [PATCH] helm_registry_auth: document/test stdout for registry success messages (Helm 4.2.1) (#1147) * helm: document/test stdout for registry success messages (Helm 4.2.1) Helm < 4.2.1 prints registry success messages (Login Succeeded, Pushed, Pulled, Digest) to stderr (helm/helm#13464); Helm >= 4.2.1 moves them to stdout (helm/helm#32056). The modules key on the return code, so logic is unaffected, but the RETURN docs and integration assertions assumed stderr. - helm_registry_auth: note the version-dependent output stream in the RETURN documentation. - helm_registry_auth integration tests: assert success messages against the stdout+stderr union so they pass on both old and new Helm. Fixes: #1146 Co-Authored-By: Claude Opus 4.8 * ci: empty commit to re-trigger ci --- .../20260612-helm-registry-output-stream.yml | 2 ++ plugins/modules/helm_registry_auth.py | 16 +++++++++++----- .../helm_registry_auth/tasks/run_tests.yml | 16 +++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/20260612-helm-registry-output-stream.yml diff --git a/changelogs/fragments/20260612-helm-registry-output-stream.yml b/changelogs/fragments/20260612-helm-registry-output-stream.yml new file mode 100644 index 00000000..43f15c98 --- /dev/null +++ b/changelogs/fragments/20260612-helm-registry-output-stream.yml @@ -0,0 +1,2 @@ +minor_changes: + - helm_registry_auth - document that, as of Helm 4.2.1, registry success messages such as ``Login Succeeded`` are printed to stdout instead of stderr (https://github.com/ansible-collections/kubernetes.core/pull/1147). diff --git a/plugins/modules/helm_registry_auth.py b/plugins/modules/helm_registry_auth.py index 6346e571..7dff062d 100644 --- a/plugins/modules/helm_registry_auth.py +++ b/plugins/modules/helm_registry_auth.py @@ -106,17 +106,23 @@ EXAMPLES = r""" RETURN = r""" stdout: type: str - description: Full C(helm) command stdout, in case you want to display it or examine the event log + description: + - Full C(helm) command stdout, in case you want to display it or examine the event log. + - As of Helm 4.2.1 success messages such as C(Login Succeeded) are printed to stdout + (see U(https://github.com/helm/helm/pull/32056)). On earlier versions they are printed to stderr. returned: always -stout_lines: + sample: 'Login Succeeded\n' +stdout_lines: type: list description: Full C(helm) command stdout, in case you want to display it or examine the event log returned: always stderr: type: str - description: >- - Full C(helm) command stderr, in case you want to display it or examine the event log. - Please be note that helm binnary may print messages to stderr even if the command is successful. + description: + - Full C(helm) command stderr, in case you want to display it or examine the event log. + - Please note that the helm binary may print messages to stderr even if the command is successful. + - On Helm versions earlier than 4.2.1, success messages such as C(Login Succeeded) are printed + here; as of Helm 4.2.1 they are printed to stdout (see U(https://github.com/helm/helm/pull/32056)). returned: always sample: 'Login Succeeded\n' stderr_lines: diff --git a/tests/integration/targets/helm_registry_auth/tasks/run_tests.yml b/tests/integration/targets/helm_registry_auth/tasks/run_tests.yml index d4f4786a..51c33627 100644 --- a/tests/integration/targets/helm_registry_auth/tasks/run_tests.yml +++ b/tests/integration/targets/helm_registry_auth/tasks/run_tests.yml @@ -28,7 +28,9 @@ register: _helm_registry_auth_correct - name: Assert that the registry is logged in - # Helm binary prints the message to stderr, refence: https://github.com/helm/helm/issues/13464 + # Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464), + # Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056). + # Check both streams to stay version-agnostic. assert: that: - "'Login Succeeded' in _helm_registry_auth_correct.stdout_lines + _helm_registry_auth_correct.stderr_lines" @@ -43,9 +45,11 @@ failed_when: _save_chart.rc != 0 - name: Assert that the chart is saved - # Helm binary prints the message to stderr, refence: https://github.com/helm/helm/issues/13464 + # Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464), + # Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056). + # Check both streams to stay version-agnostic. assert: - that: "'Pushed: localhost:' + registry_port | string + '/test/k8s-monitoring' in _save_chart.stderr" + that: "'Pushed: localhost:' + registry_port | string + '/test/k8s-monitoring' in _save_chart.stdout + _save_chart.stderr" - name: Test logout helm_registry_auth: @@ -55,9 +59,11 @@ register: _helm_registry_auth_logout - name: Assert logout - # Helm binary prints the message to stderr + # Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464), + # Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056). + # Check both streams to stay version-agnostic. assert: - that: "'Removing login credentials' in _helm_registry_auth_logout.stderr" + that: "'Removing login credentials' in _helm_registry_auth_logout.stdout + _helm_registry_auth_logout.stderr" - name: Ensure that not able to push to the registry ansible.builtin.shell: >-