CI - Update workflow to run helm test against multiple versions (#1232)

* add matrix to test run helm tests with multiple version

* fix(ci): resolve SonarCloud security findings in helm integration workflow

Enforce HTTPS/TLS for the ansible-core download and pin and wheel-lock the
selinux_please_lie_to_me install. Suppress the two remaining findings
(ansible-core source install and shared test-requirements.txt pins) that
cannot be fixed here without breaking CI, following the existing
sonar.issue.ignore.multicriteria pattern.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(ci): fix remaining sanity and SonarCloud quality gate failures

Remove stale import-3.9!skip entries from tests/sanity/ignore-2.23.txt;
ansible-core devel dropped the import-3.9 sanity test target entirely, so
referencing it now fails the "ignores" sanity test itself.

Switch the e4/e5 sonar.issue.ignore.multicriteria resourceKey patterns in
sonar-project.properties from a bare literal filename to a **/ glob, matching
the working e1-e3 patterns. The literal path was not matching during
analysis, so the two intended suppressions (githubactions:S8541/S8544 on
integration-tests-helm.yaml) never took effect and kept failing the new
code security rating gate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test(helm): add regression coverage for plain_http/helm-diff fix, enable helm_uninstall target

helm_diff: replace the unreachable "< 3.13.0" OCI-chart block (plain_http is
only ever true for >= 3.13.0, so the two conditions could never both hold)
with a ">= 3.13.0" case that installs helm-diff and runs a plain_http diff
upgrade, exercising the exact path the plain_http/--plain-http fix touches.

helm_plain_http: replace the HTTPS Bitnami-backed test with one that pushes
a local chart to the plain-HTTP registry from setup_helm_registry and
exercises helm/helm_pull/helm_template against it, so success assertions
verify plain HTTP actually works rather than only that the flag was passed.
Also drop the now-stale redis* .gitignore entry.

helm_uninstall: add the missing aliases file (every sibling helm target has
one; without it the target is not picked up by CI target selection) and
replace a dead assertion gated on helm < 3.7.0 with one that matches the
versions this target actually runs against (>= 3.8.0).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(ci): make the S8541/S8544 SonarCloud suppressions actually take effect

The three flagged lines (ansible-core source install, shared
requirements.txt install) have been open since before the suppression
rules were added, and two prior attempts at the e4/e5 resourceKey pattern
(literal filename, then a **/filename glob) left them unresolved across
multiple fresh analyses - already-raised issues on unchanged lines do not
appear to get re-evaluated against newly added ignore rules.

Broaden e4/e5 to the same .github/workflows/**/*.yaml pattern already
proven to work for e3 (confirmed: githubactions:S7637 has 20 open issues
org-wide but 0 here, despite this repo having @main references e3 is meant
to suppress). This is also a more honest scope: all_green_check.yaml has
the identical ansible-core-from-source and shared-requirements.txt
patterns, not just integration-tests-helm.yaml.

Also make a no-op edit to the two flagged lines (reorder the pip flag and
the two -r files; verified zero package overlap between requirements.txt
and test-requirements.txt) so SonarCloud treats them as changed and
re-evaluates them against the fixed suppression rule, rather than carrying
forward the stale pre-suppression issue state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix tests and the possibility to run helm tests locally
Fix linters errors

---------

Co-authored-by: GomathiS <gosriniv@redhat.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Bikouo Aubin
2026-10-20 16:16:03 +02:00
committed by GitHub
co-authored by GomathiS Claude Sonnet 5
parent ebb0d7f087
commit 782672d2fd
107 changed files with 1044 additions and 922 deletions
@@ -1 +0,0 @@
redis*
@@ -0,0 +1,12 @@
---
helm_binary: helm
setup_helm_version_binary_path: "{{ helm_binary }}"
test_namespace: helm-plain-http
# Matches the plain-HTTP registry stood up by the setup_helm_registry role.
registry_host: "localhost:6035"
registry_username: testuser
registry_password: 'pass123!'
registry_repo_path: testing
chart_name: test-chart-plain-http
chart_version: "0.1.0"
@@ -0,0 +1,6 @@
apiVersion: v2
name: test-chart-plain-http
description: A minimal chart used to exercise plain_http against a plain-HTTP OCI registry
type: application
version: 0.1.0
appVersion: "default"
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-chart-plain-http-configmap
data:
myValue: test
@@ -1,4 +0,0 @@
[all]
helm-3.12.3 helm_version=v3.12.3 test_namespace=helm-plain-http-v3-12-3 tests_should_failed=true
helm-3.18.2 helm_version=v3.18.2 test_namespace=helm-plain-http-v3-18-2 tests_should_failed=false
helm-4.0.0 helm_version=v4.0.0 test_namespace=helm-plain-http-v4-0-0 tests_should_failed=false
@@ -0,0 +1,5 @@
---
dependencies:
- setup_namespace
- setup_helm_registry
- setup_helm_version
@@ -1,15 +0,0 @@
- name: Run test for helm plain http option
hosts: all
gather_facts: true
strategy: free
vars:
ansible_connection: local
ansible_python_interpreter: "{{ ansible_playbook_python }}"
chart_test_oci: "oci://registry-1.docker.io/bitnamicharts/redis"
roles:
- role: setup_namespace
tasks:
- ansible.builtin.include_tasks: tasks/test.yaml
@@ -1,95 +0,0 @@
---
- name: Run test for helm
block:
- name: Create temporary directory to install chart In
ansible.builtin.tempfile:
state: directory
suffix: .helm
register: install_path
- name: Install required helm version
ansible.builtin.include_role:
name: install_helm
vars:
helm_install_path: "{{ install_path.path }}"
# helm
- name: Run helm with plain_http
kubernetes.core.helm:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ chart_test_oci }}"
release_name: test-secure
release_namespace: "{{ test_namespace }}"
create_namespace: true
plain_http: true
register: install_chart
ignore_errors: true
- name: Ensure module failed as expected
ansible.builtin.assert:
that:
- install_chart is failed
- '"plain_http requires helm >= 3.13.0" in install_chart.msg'
when: tests_should_failed | bool
- name: Ensure the result command contains the expected option
ansible.builtin.assert:
that:
- install_chart is not failed
- '"--plain-http" in install_chart.command'
when: not (tests_should_failed | bool)
# helm_pull
- name: Trying to download helm chart with option plain_http
kubernetes.core.helm_pull:
chart_ref: "{{ chart_test_oci }}"
destination: "{{ playbook_dir }}"
binary_path: "{{ helm_binary }}"
plain_http: true
register: pull_chart
ignore_errors: true
- name: Ensure module failed as expected
ansible.builtin.assert:
that:
- pull_chart is failed
- '"plain_http requires helm >= 3.13.0" in pull_chart.msg'
when: tests_should_failed | bool
- name: Ensure the result command contains the expected option
ansible.builtin.assert:
that:
- pull_chart is not failed
- '"--plain-http" in pull_chart.command'
when: not (tests_should_failed | bool)
# helm_template
- name: Test helm render template
kubernetes.core.helm_template:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ chart_test_oci }}"
output_dir: "{{ playbook_dir }}"
plain_http: true
register: template
ignore_errors: true
- name: Ensure module failed as expected
ansible.builtin.assert:
that:
- template is failed
- '"plain_http requires helm >= 3.13.0" in template.msg'
when: tests_should_failed | bool
- name: Ensure the result command contains the expected option
ansible.builtin.assert:
that:
- template is not failed
- '"--plain-http" in template.command'
when: not (tests_should_failed | bool)
always:
- name: Delete temporary file
ansible.builtin.file:
path: "{{ install_path.path }}"
state: absent
ignore_errors: true
@@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbooks/play.yaml -i inventory.ini "$@"
@@ -0,0 +1,167 @@
---
- name: Test plain_http against a plain-HTTP OCI registry
vars:
plain_http_supported: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
chart_ref_oci: "oci://{{ registry_host }}/{{ registry_repo_path }}/{{ chart_name }}"
block:
- name: Create a temporary directory to hold the chart
ansible.builtin.tempfile:
state: directory
suffix: .chart
register: _tmpd
# helm < 3.13.0 cannot talk to a plain-HTTP OCI registry: the modules reject
# plain_http before issuing any helm command, so no chart has to be present.
- name: Ensure plain_http is rejected on unsupported helm versions
when: not (plain_http_supported | bool)
block:
- name: Attempt helm install with plain_http
kubernetes.core.helm:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ chart_ref_oci }}"
chart_version: "{{ chart_version }}"
release_name: test-secure
release_namespace: "{{ test_namespace }}"
create_namespace: true
plain_http: true
register: install_chart
ignore_errors: true
- name: Ensure helm failed with the version error
ansible.builtin.assert:
that:
- install_chart is failed
- '"plain_http requires helm >= 3.13.0" in install_chart.msg'
- name: Attempt helm_pull with plain_http
kubernetes.core.helm_pull:
chart_ref: "{{ chart_ref_oci }}"
chart_version: "{{ chart_version }}"
destination: "{{ _tmpd.path }}"
binary_path: "{{ helm_binary }}"
plain_http: true
register: pull_chart
ignore_errors: true
- name: Ensure helm_pull failed with the version error
ansible.builtin.assert:
that:
- pull_chart is failed
- '"plain_http requires helm >= 3.13.0" in pull_chart.msg'
- name: Attempt helm_template with plain_http
kubernetes.core.helm_template:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ chart_ref_oci }}"
chart_version: "{{ chart_version }}"
plain_http: true
register: template
ignore_errors: true
- name: Ensure helm_template failed with the version error
ansible.builtin.assert:
that:
- template is failed
- '"plain_http requires helm >= 3.13.0" in template.msg'
# helm >= 3.13.0 exercises plain HTTP end to end against the registry stood up
# by the setup_helm_registry role, so the assertions prove the flag actually
# reaches a plain-HTTP registry rather than just appearing in the command.
- name: Exercise plain_http end to end
when: plain_http_supported | bool
block:
- name: Copy the test chart
ansible.builtin.copy:
src: "{{ chart_name }}"
dest: "{{ _tmpd.path }}/"
- name: Push the chart to the plain-HTTP registry
ansible.builtin.include_role:
name: push_to_helm_registry
vars:
chart_local_path: "{{ _tmpd.path }}/{{ chart_name }}"
chart_repo_path: "{{ registry_repo_path }}"
helm_binary_path: "{{ helm_binary }}"
- name: Log into the helm registry
ansible.builtin.shell: >-
echo '{{ registry_password }}' | {{ helm_binary }} registry login
-u {{ registry_username }} --password-stdin {{ registry_host }}
{{ helm_version | string is ansible.builtin.version('3.18.0', '>=') | ternary('--plain-http', '') }}
- name: Install the chart over plain HTTP
kubernetes.core.helm:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ chart_ref_oci }}"
chart_version: "{{ chart_version }}"
release_name: test-secure
release_namespace: "{{ test_namespace }}"
create_namespace: true
plain_http: true
register: install_chart
- name: Ensure the release installed over plain HTTP
ansible.builtin.assert:
that:
- install_chart is changed
- '"--plain-http" in install_chart.command'
- name: Pull the chart over plain HTTP
kubernetes.core.helm_pull:
chart_ref: "{{ chart_ref_oci }}"
chart_version: "{{ chart_version }}"
destination: "{{ _tmpd.path }}"
binary_path: "{{ helm_binary }}"
plain_http: true
register: pull_chart
- name: Ensure the chart was pulled over plain HTTP
ansible.builtin.assert:
that:
- pull_chart is not failed
- '"--plain-http" in pull_chart.command'
- name: Render the chart over plain HTTP
kubernetes.core.helm_template:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ chart_ref_oci }}"
chart_version: "{{ chart_version }}"
plain_http: true
register: template
- name: Ensure the chart rendered over plain HTTP
ansible.builtin.assert:
that:
- template is not failed
- '"--plain-http" in template.command'
- "'kind: ConfigMap' in template.stdout"
always:
- name: Uninstall the release
kubernetes.core.helm:
binary_path: "{{ helm_binary }}"
release_name: test-secure
release_namespace: "{{ test_namespace }}"
state: absent
when: plain_http_supported | bool
ignore_errors: true
- name: Remove the test namespace
kubernetes.core.k8s:
api_version: v1
kind: Namespace
name: "{{ test_namespace }}"
state: absent
wait: true
ignore_errors: true
- name: Log out of the helm registry
ansible.builtin.command: "{{ helm_binary }} registry logout {{ registry_host }}"
when: plain_http_supported | bool
ignore_errors: true
- name: Remove the temporary directory
ansible.builtin.file:
path: "{{ _tmpd.path }}"
state: absent
ignore_errors: true