mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-11-22 07:00:19 +00:00
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:
co-authored by
GomathiS
Claude Sonnet 5
parent
ebb0d7f087
commit
782672d2fd
@@ -1,2 +1,2 @@
|
||||
---
|
||||
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||
helm_binary: "helm"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
- connection: local
|
||||
gather_facts: true
|
||||
hosts: localhost
|
||||
|
||||
roles:
|
||||
- helm_plugin
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||
export ANSIBLE_ROLES_PATH=../
|
||||
ansible-playbook playbook.yaml "$@"
|
||||
@@ -1,8 +1,3 @@
|
||||
---
|
||||
- name: Run tests
|
||||
include_tasks: run_tests.yml
|
||||
loop_control:
|
||||
loop_var: helm_version
|
||||
with_items:
|
||||
- "v3.17.0"
|
||||
- "v4.0.0"
|
||||
ansible.builtin.include_tasks: run_tests.yml
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
---
|
||||
- name: "Install {{ helm_version }}"
|
||||
include_role:
|
||||
name: install_helm
|
||||
|
||||
- block:
|
||||
- name: Install env plugin in check mode
|
||||
helm_plugin:
|
||||
@@ -13,7 +9,7 @@
|
||||
register: check_install_env
|
||||
check_mode: true
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- check_install_env.changed
|
||||
|
||||
@@ -25,7 +21,7 @@
|
||||
verify: false
|
||||
register: install_env
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install_env.changed
|
||||
|
||||
@@ -34,7 +30,7 @@
|
||||
binary_path: "{{ helm_binary }}"
|
||||
register: plugin_info
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- plugin_info.plugin_list is defined
|
||||
|
||||
@@ -46,7 +42,7 @@
|
||||
verify: false
|
||||
register: install_env
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- not install_env.changed
|
||||
|
||||
@@ -59,7 +55,7 @@
|
||||
register: check_uninstall_env
|
||||
check_mode: true
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- check_uninstall_env.changed
|
||||
|
||||
@@ -70,7 +66,7 @@
|
||||
plugin_name: env
|
||||
register: uninstall_env
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- uninstall_env.changed
|
||||
|
||||
@@ -81,7 +77,7 @@
|
||||
plugin_name: env
|
||||
register: uninstall_env
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- not uninstall_env.changed
|
||||
|
||||
@@ -95,7 +91,7 @@
|
||||
# https://github.com/ansible-collections/community.kubernetes/issues/399
|
||||
- block:
|
||||
- name: Copy required plugin files
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "files/sample_plugin"
|
||||
dest: "/tmp/helm_plugin_test/"
|
||||
|
||||
@@ -107,7 +103,7 @@
|
||||
register: sample_plugin_output
|
||||
|
||||
- name: Assert that sample_plugin is installed or not
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- sample_plugin_output.changed
|
||||
|
||||
@@ -117,13 +113,13 @@
|
||||
register: r
|
||||
|
||||
- name: Set sample_plugin version
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
plugin_version: "{{ ( r.plugin_list | selectattr('name', 'equalto', plugin_name) | list )[0].version }}"
|
||||
vars:
|
||||
plugin_name: "sample_plugin"
|
||||
|
||||
- name: Assert if sample_plugin with multiline comment is installed
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- plugin_version == "0.0.1"
|
||||
always:
|
||||
@@ -156,7 +152,7 @@
|
||||
register: plugin_list
|
||||
|
||||
- name: assert that unittest has been installed with specified version
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- plugin_list.plugin_list[0].version == "1.0.1"
|
||||
|
||||
@@ -169,7 +165,7 @@
|
||||
check_mode: true
|
||||
|
||||
- name: Assert that module reported change while running in check mode
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- _update_checkmode.changed
|
||||
- '"Updated plugin: unittest" not in _update_checkmode.stdout'
|
||||
@@ -181,8 +177,8 @@
|
||||
state: latest
|
||||
register: _update
|
||||
|
||||
- name: assert update was performed
|
||||
assert:
|
||||
- name: Assert update was performed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- _update.changed
|
||||
- '"Updated plugin: unittest" in _update.stdout'
|
||||
|
||||
Reference in New Issue
Block a user