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,4 +1,8 @@
---
- name: Define default value for helm binary path
ansible.builtin.set_fact:
helm_binary: "{{ setup_helm_binary_path | default('helm') }}"
- name: Test helm diff functionality
vars:
test_chart_ref: "/tmp/test-chart"
@@ -10,10 +14,11 @@
binary_path: "{{ helm_binary }}"
state: present
plugin_path: https://github.com/databus23/helm-diff
plugin_version: 3.9.13
verify: false
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
- name: Copy test chart
copy:
ansible.builtin.copy:
src: "test-chart/"
dest: "{{ test_chart_ref }}"
@@ -26,13 +31,13 @@
create_namespace: true
register: install
- assert:
- ansible.builtin.assert:
that:
- install is changed
- name: Modify local chart
blockinfile:
create: yes
ansible.builtin.blockinfile:
create: true
path: "{{ test_chart_ref }}/templates/anothermap.yaml"
block: !unsafe |
apiVersion: v1
@@ -55,7 +60,7 @@
- name: Check if helm diff check is correct
vars:
foo_bar_value: "+ foo: bar"
assert:
ansible.builtin.assert:
that:
- foo_bar_value in diff_result.diff.prepared
@@ -67,7 +72,7 @@
chart_ref: "{{ test_chart_ref }}"
register: install
- assert:
- ansible.builtin.assert:
that:
- install is changed
@@ -77,12 +82,12 @@
name: test-chart
namespace: "{{ helm_namespace }}"
chart_ref: "{{ test_chart_ref }}"
check_mode: yes
check_mode: true
diff: true
register: diff_result
- name: Check if no diff in check mode when no change
assert:
ansible.builtin.assert:
that:
- '"diff" not in diff_result'
@@ -94,12 +99,12 @@
chart_ref: "{{ test_chart_ref }}"
register: install
- assert:
- ansible.builtin.assert:
that:
- install is not changed
- name: Modify values
blockinfile:
ansible.builtin.blockinfile:
create: true
path: "{{ test_chart_ref }}/values.yml"
block: |
@@ -116,7 +121,7 @@
- "{{ test_chart_ref }}/values.yml"
register: install
- assert:
- ansible.builtin.assert:
that:
- install is changed
@@ -130,7 +135,7 @@
- "{{ test_chart_ref }}/values.yml"
register: install
- assert:
- ansible.builtin.assert:
that:
- install is not changed
@@ -146,7 +151,7 @@
- "{{ test_chart_ref }}/values.yml"
register: install
- assert:
- ansible.builtin.assert:
that:
- install is changed
@@ -162,7 +167,7 @@
- "{{ test_chart_ref }}/values.yml"
register: install
- assert:
- ansible.builtin.assert:
that:
- install is not changed
@@ -181,7 +186,7 @@
value_type: string
register: install
- assert:
- ansible.builtin.assert:
that:
- install is changed
@@ -200,7 +205,7 @@
value_type: string
register: install
- assert:
- ansible.builtin.assert:
that:
- install is not changed
@@ -213,7 +218,7 @@
ignore_errors: true
- name: Define chart variables
set_fact:
ansible.builtin.set_fact:
test_chart_values:
myValue: 'Some ConfigMap data value'
myConfigmapName: 'ansible-config-from-url'
@@ -247,7 +252,9 @@
path: '{{ _tmpd.path }}'
- name: Log into Helm registry
ansible.builtin.command: "{{ helm_binary }} registry login -u testuser -p 'pass123!' localhost:6035"
ansible.builtin.shell: >-
echo 'pass123!' | {{ helm_binary }} registry login -u testuser --password-stdin localhost:6035
{{ helm_version | string is ansible.builtin.version("3.18.0", ">=") | ternary('--plain-http', '--insecure') }}
- name: Install chart from remote URL
helm:
@@ -257,6 +264,7 @@
namespace: "{{ helm_namespace }}"
name: another-chart
release_values: "{{ test_chart_values }}"
plain_http: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
- name: Upgrade chart
helm:
@@ -266,44 +274,21 @@
namespace: "{{ helm_namespace }}"
name: another-chart
release_values: "{{ test_chart_values }}"
plain_http: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
check_mode: true
register: _upgrade
- name: Assert that module raised a warning
assert:
ansible.builtin.assert:
that:
- not _upgrade.changed
- _upgrade.warnings is defined
- _upgrade.warnings | length == 1
- _upgrade.warnings[0] == "The default idempotency check can fail to report changes in certain cases. Install helm diff >= 3.4.1 for better results."
- name: Install helm diff (version=3.4.1)
helm_plugin:
binary_path: "{{ helm_binary }}"
state: present
plugin_path: https://github.com/databus23/helm-diff
plugin_version: 3.4.1
- name: Upgrade chart once again
helm:
binary_path: "{{ helm_binary }}"
chart_ref: "{{ test_chart_ref_url }}"
chart_version: 0.1.0
namespace: "{{ helm_namespace }}"
name: another-chart
release_values: "{{ test_chart_values }}"
check_mode: true
register: _upgrade_2
- name: Assert that module raised a warning
assert:
that:
- _upgrade_2.changed
- _upgrade_2.warnings is not defined
always:
- name: Remove chart directory
file:
ansible.builtin.file:
path: "{{ test_chart_ref }}"
state: absent
ignore_errors: true
@@ -324,6 +309,7 @@
wait: true
ignore_errors: true
- include_tasks: reuse_values.yml
- ansible.builtin.include_tasks: reuse_values.yml
- include_tasks: reset_then_reuse_values.yml
- ansible.builtin.include_tasks: reset_then_reuse_values.yml
when: helm_version | string is ansible.builtin.version('3.8.0', '>')
@@ -1,6 +1,6 @@
---
- name: Create temporary directory for helm chart
tempfile:
ansible.builtin.tempfile:
suffix: .helm
state: directory
register: helm_dir
@@ -16,7 +16,8 @@
binary_path: "{{ helm_binary }}"
state: present
plugin_path: https://github.com/databus23/helm-diff
plugin_version: 3.9.14
verify: false
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
- name: Copy test chart
ansible.builtin.copy:
@@ -58,7 +59,7 @@
register: helm_upgrade
- name: Ensure task did not reported change
assert:
ansible.builtin.assert:
that:
- helm_upgrade is not changed
@@ -75,7 +76,7 @@
register: helm_upgrade
- name: Ensure task reported change
assert:
ansible.builtin.assert:
that:
- helm_upgrade is changed
@@ -88,19 +89,24 @@
ignore_errors: true
- name: Delete Helm folders
file:
ansible.builtin.file:
path: /tmp/helm/
state: absent
- name: Install old version of helm
ansible.builtin.include_role:
name: install_helm
name: setup_helm
vars:
helm_version: "v3.8.0"
setup_helm_version: "v3.8.0"
helm_install_path: "{{ helm_dir.path }}/helm_v3_8_0"
- name: Set path to helm binary v3.8.0
ansible.builtin.set_fact:
helm_binary_path_v3_8_0: "{{ helm_dir.path }}/helm_v3_8_0/helm"
- name: Upgrade helm release (with reset_then_reuse_values=true)
kubernetes.core.helm:
binary_path: "{{ helm_binary }}"
binary_path: "{{ helm_binary_path_v3_8_0 }}"
chart_ref: "{{ test_chart_path }}"
reuse_values: false
reset_then_reuse_values: true
@@ -112,25 +118,26 @@
ignore_errors: true
- name: Debug
debug:
ansible.builtin.debug:
var: helm_upgrade
- name: Ensure warning for Helm version
assert:
ansible.builtin.assert:
that:
- helm_upgrade is failed
- '"reset_then_reuse_values requires helm >= 3.14.0, current version is" in helm_upgrade.msg'
- name: Install helm diff
helm_plugin:
binary_path: "{{ helm_binary }}"
binary_path: "{{ helm_binary_path_v3_8_0 }}"
state: present
plugin_path: https://github.com/databus23/helm-diff
plugin_version: "3.8.0"
verify: false
- name: Upgrade helm release (with reset_then_reuse_values=true)
kubernetes.core.helm:
binary_path: "{{ helm_binary }}"
binary_path: "{{ helm_binary_path_v3_8_0 }}"
chart_ref: "{{ test_chart_path }}"
reuse_values: false
reset_then_reuse_values: true
@@ -142,23 +149,23 @@
ignore_errors: true
- name: Debug
debug:
ansible.builtin.debug:
var: helm_upgrade
- name: Ensure warning for Helm Diff version
assert:
ansible.builtin.assert:
that:
- helm_upgrade is failed
- '"reset_then_reuse_values requires helm diff >= 3.9.12, current version is" in helm_upgrade.msg'
always:
- name: Delete Helm folders
file:
ansible.builtin.file:
path: /tmp/helm/
state: absent
- name: Remove temporary directory
file:
ansible.builtin.file:
path: "{{ helm_dir.path }}"
state: absent
ignore_errors: true
@@ -1,6 +1,6 @@
---
- name: Create temporary directory for helm chart
tempfile:
ansible.builtin.tempfile:
suffix: .helm
state: directory
register: helm_dir
@@ -17,7 +17,8 @@
binary_path: "{{ helm_binary }}"
state: present
plugin_path: https://github.com/databus23/helm-diff
plugin_version: 3.9.4
verify: false
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
- name: Copy test chart
ansible.builtin.copy:
@@ -50,7 +51,7 @@
register: helm_upgrade
- name: Ensure task did not reported change
assert:
ansible.builtin.assert:
that:
- helm_upgrade is not changed
@@ -66,7 +67,7 @@
register: helm_upgrade
- name: Ensure task reported change
assert:
ansible.builtin.assert:
that:
- helm_upgrade is changed