Ensure compatibility with Helm v4 for the collection (#1090) (#1096)

This is a backport of PR #1090 as merged into main (e6076e5).
SUMMARY

Ensure compatibility with Helm v4 for modules helm_plugin and helm_plugin_info
Partially addresses #1038

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

helm_plugin
helm_plugin_info
helm_info
helm_pull
helm_registry_auth
helm
helm_template

Reviewed-by: Bikouo Aubin
Reviewed-by: Matthew Johnson
This commit is contained in:
patchback[bot]
2026-03-17 15:03:02 +00:00
committed by GitHub
parent 0709ea31c9
commit a3f2438e9d
86 changed files with 1161 additions and 930 deletions

View File

@@ -455,9 +455,9 @@ def test_module_get_helm_set_values_args(set_values, expected):
("3.17.0", False),
("2.9.0", True),
("2.17.0", True),
("4.0.0", True),
("4.1.0", True),
("5.0.0", True),
("4.0.0", False),
("4.1.0", False),
("5.0.0", False),
],
)
def test_module_validate_helm_version(_ansible_helm_module, helm_version, should_fail):
@@ -469,8 +469,10 @@ def test_module_validate_helm_version(_ansible_helm_module, helm_version, should
_ansible_helm_module.validate_helm_version()
_ansible_helm_module.fail_json.assert_called_once()
call_args = _ansible_helm_module.fail_json.call_args
assert "Helm version must be >=3.0.0,<4.0.0" in call_args[1]["msg"]
assert helm_version in call_args[1]["msg"]
assert (
f"Helm version must be >= 3.0.0, current version is {helm_version}"
== call_args[1]["msg"]
)
else:
_ansible_helm_module.validate_helm_version()
_ansible_helm_module.fail_json.assert_not_called()

View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2026, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
parse_helm_plugin_list,
)
def test_parse_helm_plugin_list_empty():
assert parse_helm_plugin_list() == []
@pytest.mark.parametrize(
"output,expected",
[
(
"""
NAME VERSION TYPE APIVERSION PROVENANCE SOURCE
diff 3.4.1 cli/v1 legacy unknown unknown
""",
[
dict(
name="diff",
version="3.4.1",
type="cli/v1",
apiversion="legacy",
provenance="unknown",
source="unknown",
)
],
),
(
"""
NAME VERSION DESCRIPTION
diff 3.4.1 Preview helm upgrade changes as a diff
""",
[
dict(
name="diff",
version="3.4.1",
description="Preview helm upgrade changes as a diff",
)
],
),
],
)
def test_parse_helm_plugin_list_values(output, expected):
assert parse_helm_plugin_list(output.split("\n")) == expected