ci: add helm chart-testing and unittest workflow#2427
Open
giuliocalzo wants to merge 1 commit intoNVIDIA:mainfrom
Open
ci: add helm chart-testing and unittest workflow#2427giuliocalzo wants to merge 1 commit intoNVIDIA:mainfrom
giuliocalzo wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
c8e4cbd to
37b08f4
Compare
Adds a `helm` GitHub Actions workflow that runs `ct lint` and `helm-unittest` against the gpu-operator chart on PRs that touch `deployments/`, plus a unit-test suite (with snapshots) covering the chart's core templates so chart regressions are caught in CI. Workflow: - `lint` job runs `ct lint` (with `--validate-maintainers=false` since the chart doesn't declare maintainers) using `CHART_DIR=deployments`. - `unittest` job installs `helm-unittest v1.0.3` and runs `helm unittest deployments/gpu-operator`. - Triggers only on PRs that change `deployments/gpu-operator/**`. Tests cover: operator deployment, ClusterPolicy, RBAC, NodeFeatureRules, NvidiaDriver, MIG/DCGM/device-plugin custom configs, cleanup and upgrade CRD hooks, OpenShift readonly-fs SCC, extra objects, and input validations. Snapshots are committed under `__snapshot__/`. Also: - Fix yamllint comment-spacing in `values.yaml` so `ct lint` passes. - Add `tests/` to `.helmignore` so unittest fixtures and snapshots are excluded from the packaged chart. Signed-off-by: Giulio Calzolari <gcalzolari@nvidia.com>
a626e1a to
3e8fa1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Add a
helmGitHub Actions workflow that runsct lintandhelm-unittestagainst thegpu-operatorchart on PRs that touchdeployments/, plus a unit-test suite (with snapshots) covering the chart's core templates.Why helm unittest?
The
gpu-operatorchart is the primary install surface for the operator and ships a large set of templates whose behavior depends heavily onvalues.yaml, conditional logic, and platform-specific branches (OpenShift, MIG, NRI/CDI, etc.). Today, regressions in those templates can only be caught by spinning up a cluster, which is slow and not part of every PR.helm-unittestmakes it cheap to lock that behavior down in CI:helm templatein-process under a few hundred milliseconds, with no cluster, no network, no real Kubernetes API. Suitable for every PR.values.yamlcontracts. Eachset:block is an executable example of a supported configuration (develMode,imagePullSecrets, custom DCGM/MIG/device-plugin configs, NRI + CDI validation, etc.), so the expected behavior of values is visible in the repo.failedTemplateassertions confirm that input validations (e.g. "the NRI Plugin cannot be enabled when CDI is disabled") actually fire, whichct lintalone does not exercise.helm unittest -u, so intentional template changes are an explicit, reviewable diff in the PR.What's included
.github/workflows/helm.yamlwith two jobs:lint—helm/chart-testing-action(ct lint) against the chart.unittest— installshelm-unittestand runshelm unittest deployments/gpu-operator.deployments/gpu-operator/**.helm-unittestsuites underdeployments/gpu-operator/tests/covering: operator deployment, ClusterPolicy, ClusterRole/Binding, Role/Binding, ServiceAccount, NodeFeatureRules, NvidiaDriver, MIG/DCGM/device-plugin custom configs, cleanup and upgrade CRD hooks, OpenShift readonly-fs SCC, extra objects, and input validations. Snapshots are committed under__snapshot__/.Testing
helm unittest deployments/gpu-operatorpasses locally — 17 suites, 62 tests, 24 snapshots.helm / lintandhelm / unittestjobs are expected to be green on this PR.