G7: helm lint per values set, render-defaults input, fail on empty render
- reusable-helm-lint: new `render-defaults` input (default true) for charts whose templates require values the defaults leave empty. - Lint each values set, not only the defaults. - Render to a named .yaml file and fail if nothing rendered; kubeconform passes on empty input and skips files without a .yaml extension. - docs/ci-cd/adding-ci.md: placeholder-values convention, G7 rollout table, test results. Refs DevOps/software-infrastructure#55 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+24
-3
@@ -17,7 +17,7 @@ nothing is installed at run time and versions are the same everywhere.
|
||||
| Workflow | For | Runs |
|
||||
|---|---|---|
|
||||
| `reusable-ansible-role-lint.yaml` | `ansible-role-*` repos | `ansible-lint`, which also applies yamllint's rules |
|
||||
| `reusable-helm-lint.yaml` | Helm chart repos | `helm lint`, then `helm template` piped to `kubeconform` |
|
||||
| `reusable-helm-lint.yaml` | Helm chart repos | `helm lint`, then `helm template` checked by `kubeconform` |
|
||||
| `reusable-dockerfile-lint.yaml` | Repos with a Dockerfile | `hadolint` |
|
||||
| `reusable-secret-scan.yaml` | Every repo | `gitleaks`, see [secret-scanning.md](secret-scanning.md) |
|
||||
|
||||
@@ -101,12 +101,28 @@ jobs:
|
||||
| `tools-image` | `gitea.eom.dev/devops/ci-tools:1.0.0` | |
|
||||
| `chart-path` | `.` | Directory with `Chart.yaml`. |
|
||||
| `kube-version` | `1.31.2` | The cluster's version on 2026-11-14. Bump it when the cluster is upgraded. |
|
||||
| `values-files` | empty | Extra values files to render as well, space-separated. The defaults are always rendered. |
|
||||
| `values-files` | empty | Values files relative to the chart, space-separated. Each one is linted and rendered on its own. |
|
||||
| `render-defaults` | `true` | Also check the chart's defaults alone. Set `false` when templates `required` values the defaults leave empty. |
|
||||
| `strict` | `false` | `helm lint --strict`. |
|
||||
|
||||
Chart dependencies are built if `Chart.yaml` has any. kubeconform skips kinds
|
||||
it has no schema for (CRDs) rather than failing on them. Schemas are fetched
|
||||
from GitHub at run time.
|
||||
from GitHub at run time. The job fails if a values set renders no resources,
|
||||
because kubeconform alone would pass an empty render.
|
||||
|
||||
**Charts that need values to render.** Put CI-only placeholder values in the
|
||||
chart's `ci/` directory (the chart-testing convention), for example
|
||||
`ci/minimal-values.yaml`, set `render-defaults: false`, and list the files in
|
||||
`values-files`. Use obvious placeholders (`example.com`,
|
||||
`ci-placeholder-not-a-secret`), never real settings.
|
||||
|
||||
**Rolled out (G7, #55), manual-only until S8 and G1:**
|
||||
|
||||
| Repo | Values checked |
|
||||
|---|---|
|
||||
| DevOps/helm-jamulus | defaults |
|
||||
| DevOps/helm-mailman3 | `ci/minimal-values.yaml` (SQLite, postfix sidecar), `ci/postgresql-values.yaml` (the deployed shape) |
|
||||
| DevOps/helm-pixelfed | upstream's `test-values/postgresql-plain.yaml`. Prepared on branch `ci/helm-lint`, not `main`: adding `.gitea/workflows/` there stops Gitea running upstream's `.github/workflows`, which is Eric's call (#46). |
|
||||
|
||||
### Dockerfile
|
||||
|
||||
@@ -145,6 +161,11 @@ a local build of the tools image (1.0.0), against:
|
||||
| helm-lint | DevOps/helm-jamulus | passes |
|
||||
| | a template referencing a missing value | fails in `helm lint` |
|
||||
| | a Service with a string port | fails in kubeconform |
|
||||
| helm-lint (2026-11-15, G7) | helm-mailman3 with `ci/` values, helm-pixelfed with its test values | pass (7 + 15, and 27 resources valid) |
|
||||
| | helm-mailman3 with defaults only | fails in `helm lint` (missing `admin`) |
|
||||
| | helm-mailman3 at 5facaf7 (before the G7 fix) | fails in `helm lint` (template parse error) |
|
||||
| | a chart with no templates | fails: rendered no resources |
|
||||
| | `render-defaults: false` with no values files | fails with a clear message |
|
||||
| dockerfile-lint | `images/ci-tools/Dockerfile` | passes |
|
||||
| | `FROM debian:latest` with unpinned apt | fails (DL3007, DL3008) |
|
||||
| | repo with no Dockerfile | fails with a clear message |
|
||||
|
||||
Reference in New Issue
Block a user