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
@@ -0,0 +1,210 @@
name: Integration tests Helm
concurrency:
group: integration-tests-helm-${{ github.head_ref }}
cancel-in-progress: true
on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
branches:
- main
- stable-*
permissions: {}
jobs:
splitter:
env:
source_dir: "./source"
runs-on: ubuntu-latest
outputs:
helm_targets: ${{ steps.select-targets.outputs.targets }}
permissions:
pull-requests: read
contents: read
steps:
- name: Checkout the collection repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ${{ env.source_dir }}
fetch-depth: "0"
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: list changes for pull request
id: splitter
uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@4678c74a7d712d55e663c88f66eec6d9c3642550
with:
collections_to_test: ${{ env.source_dir }}
total_jobs: 8
- name: Select Helm targets
id: select-targets
run: |
import os, json
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
data = os.environ.get("ALL_TEST_TARGETS")
targets = []
for target in data.split(";"):
if target and ':' in target:
targets.extend([v for v in target.split(':', maxsplit=1)[1].split(',') if v.startswith('helm')])
fh.write(f'targets={json.dumps(targets)}\n')
shell: python
env:
ALL_TEST_TARGETS: ${{ steps.splitter.outputs.test_targets }}
integration:
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- splitter
if: ${{ needs.splitter.outputs.helm_targets != '' && needs.splitter.outputs.helm_targets != '[]' }}
env:
source: "./source"
ansible_posix: "./ansible_posix"
community_general: "./community_general"
ansible-version: "milestone"
python-version: "3.13"
permissions:
contents: read
strategy:
fail-fast: false
matrix:
helm-version:
- v3.0.0
- v3.1.0
- v3.8.0
- v3.10.3
- v3.15.4
- v3.16.0
- v3.17.0
- v3.22.0
- v4.0.0
- v4.2.1
- latest
ansible_test_target: ${{ fromJson(needs.splitter.outputs.helm_targets) }}
exclude:
# helm_registry_auth: only test against recent versions to reduce CI cost
- ansible_test_target: "helm_registry_auth"
helm-version: "v3.0.0"
- ansible_test_target: "helm_registry_auth"
helm-version: "v3.1.0"
- ansible_test_target: "helm_registry_auth"
helm-version: "v3.8.0"
- ansible_test_target: "helm_registry_auth"
helm-version: "v3.10.3"
- ansible_test_target: "helm_registry_auth"
helm-version: "v3.15.4"
- ansible_test_target: "helm_registry_auth"
helm-version: "v3.16.0"
# helm install/upgrade --create-namespace requires helm >= 3.2.0
- ansible_test_target: "helm_diff"
helm-version: "v3.0.0"
- ansible_test_target: "helm_diff"
helm-version: "v3.1.0"
- ansible_test_target: "helm_diff"
helm-version: "v3.8.0"
- ansible_test_target: "helm_diff"
helm-version: "v3.10.3"
# UPGRADE FAILED: conflict occurred while applying object helm-diff/test-chart-another-configmap /v1
- ansible_test_target: "helm_diff"
helm-version: "v4.0.0"
- ansible_test_target: "helm_repository"
helm-version: "v3.0.0"
- ansible_test_target: "helm_repository"
helm-version: "v3.1.0"
- ansible_test_target: "helm_kubeconfig"
helm-version: "v3.0.0"
- ansible_test_target: "helm_kubeconfig"
helm-version: "v3.1.0"
- ansible_test_target: "helm_set_values"
helm-version: "v3.0.0"
- ansible_test_target: "helm_set_values"
helm-version: "v3.1.0"
- ansible_test_target: "helm_set_values"
helm-version: "v3.8.0"
- ansible_test_target: "helm"
helm-version: "v3.0.0"
- ansible_test_target: "helm"
helm-version: "v3.1.0"
- ansible_test_target: "helm_uninstall"
helm-version: "v3.0.0"
- ansible_test_target: "helm_uninstall"
helm-version: "v3.1.0"
name: "${{ matrix.ansible_test_target }}-${{ matrix.helm-version }}"
steps:
- name: Checkout kubernetes.core repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ${{ env.source }}
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.python-version }}
# install ansible
- name: Install ansible-core (${{ env.ansible-version }})
env:
ANSIBLE_VERSION: ${{ env.ansible-version }}
run: |
curl -sSL --proto '=https' --tlsv1.2 --retry 5 --retry-delay 10 --retry-all-errors \
"https://github.com/ansible/ansible/archive/${ANSIBLE_VERSION}.tar.gz" \
-o ansible.tar.gz
python3 -m pip install --disable-pip-version-check ./ansible.tar.gz
rm ansible.tar.gz
shell: bash
- name: Build and install collection
id: install-src
uses: ansible-network/github_actions/.github/actions/build_install_collection@4678c74a7d712d55e663c88f66eec6d9c3642550
with:
install_python_dependencies: true
source_path: ${{ env.source }}
- name: create kubernetes cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
node_image: "kindest/node:v1.29.2"
- name: "Install Helm version ${{ matrix.helm-version }}"
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
with:
version: '${{ matrix.helm-version }}'
- name: Verify Helm Installation
run: helm version
- name: Disable selinux with selinux_please_lie_to_me
run: |
python3 -m pip uninstall -y selinux
python3 -m pip install --only-binary=:all: selinux_please_lie_to_me==1.0.1
shell: bash
- name: Install python requirements
run: python3 -m pip install -r requirements.txt -r test-requirements.txt
shell: bash
working-directory: ${{ steps.install-src.outputs.collection_path }}
- name: Run integration tests
run: >-
ansible-test integration
--diff
--no-temp-workdir
--color
--skip-tags False
--retry-on-error
--continue-on-error
--python ${{ env.python-version }}
-v
${{ matrix.ansible_test_target }}
shell: bash
working-directory: ${{ steps.install-src.outputs.collection_path }}
+33 -10
View File
@@ -17,9 +17,8 @@ jobs:
source_dir: "./source"
runs-on: ubuntu-latest
outputs:
test_targets: ${{ steps.splitter.outputs.test_targets }}
test_targets_json: ${{ steps.splitter.outputs.test_targets_json }}
test_jobs: ${{ steps.splitter.outputs.test_jobs }}
test_targets: ${{ steps.select-targets.outputs.targets }}
test_jobs: ${{ steps.select-targets.outputs.jobs }}
steps:
- name: Checkout the collection repository
uses: actions/checkout@v3
@@ -35,18 +34,40 @@ jobs:
collections_to_test: ${{ env.source_dir }}
total_jobs: 8
- name: Display splitter output
- name: Remove all Helm related targets
id: select-targets
run: |
echo "test_targets=${{ steps.splitter.outputs.test_targets }}"
echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}"
echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}"
import os, json
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
data = os.environ.get("ALL_TEST_TARGETS")
index = 0
result = {}
for target in data.split(";"):
if target and ':' in target:
k8s = [v for v in target.split(':', maxsplit=1)[1].split(',') if not v.startswith('helm')]
if k8s:
result[index] = ' '.join(k8s)
index += 1
fh.write(f'targets={json.dumps(result)}\n')
fh.write(f'jobs={json.dumps(list(result.keys()))}\n')
shell: python
env:
ALL_TEST_TARGETS: ${{ steps.splitter.outputs.test_targets }}
- name: Display splitter output
env:
TARGETS: ${{ steps.select-targets.outputs.targets }}
JOBS: ${{ steps.select-targets.outputs.jobs }}
run: |
echo "targets => $TARGETS"
echo "jobs => $JOBS"
shell: bash
integration:
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- splitter
if: ${{ needs.splitter.outputs.test_targets != '' }}
if: ${{ needs.splitter.outputs.test_jobs != '' && needs.splitter.outputs.test_jobs != '[]' }}
env:
source: "./source"
cloud_common: "./cloudcommon"
@@ -87,12 +108,14 @@ jobs:
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
shell: python
env:
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }}
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets }}
WORKFLOW_ID: ${{ matrix.workflow-id }}
- name: Display ansible test targets
env:
ANSIBLE_TEST_TARGETS: ${{ steps.read-targets.outputs.ansible_test_targets }}
run: |
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}"
echo "ansible_test_targets -> $ANSIBLE_TEST_TARGETS"
- name: Checkout kubernetes.core repository
uses: actions/checkout@v3