Repository tooling¶
Each GitOps repository carries three small helper scripts at its root. They turn the repetitive parts of working on the charts into one command each, and — importantly — they run locally, with no CI dependency, so you can prove a change is sound before you ever push it.
The three cover the natural order of a change: scaffold a new application, lint what you wrote, and diff what it will actually do to the cluster.
./new-app.sh # scaffold a new application (chart + Argo CD Application CR)
./validate.sh # lint every chart (does it parse and lint?)
./helm-diff.sh # render changed charts and show the rendered-Kubernetes diff (what changes?)
ci/render-apps.sh # render Applications exactly as Argo CD does and validate them (CI and local)
ci/render-apps.sh is what CI runs on every pull request; see
Checks on every pull request for the full set.
validate.sh and helm-diff.sh are complementary: the first proves a chart lints, the second
proves you know what will actually change on the cluster when Argo CD syncs it. Run both before
opening a pull request.
new-app.sh — scaffold a new application¶
Adding an application is otherwise a multi-file ritual — a chart directory plus an Argo CD
Application custom resource under clusters/<cluster>/applications/templates/ — and it is easy to
get a path or a name subtly wrong. new-app.sh creates both from the repo's existing pattern:
applications/<name>/—Chart.yaml, a commentedvalues.yaml, andtemplates/;clusters/<cluster>/applications/templates/<name>.yaml— theApplicationCR, wired to the cluster globals like every other app.
<name> must be a lowercase DNS-1123 label; the namespace defaults to <name>. The script refuses
to overwrite anything that already exists, and prints the next steps — fill in the chart, then lint
and diff it.
Namespaces are not auto-created
Applications in these repos deliberately do not carry CreateNamespace=true. The
destination namespace must be registered by the platform namespaces application first, or the
sync will fail. new-app.sh reminds you of this in its output.
validate.sh — lint every chart¶
./validate.sh # yamllint + helm lint, all charts
./validate.sh --kubelinter # + KubeLinter
./validate.sh --kubeconform # + Kubeconform
./validate.sh applications/<app>/Chart.yaml # a single chart
validate.sh discovers every Chart.yaml in the repo and validates each one individually with
yamllint and helm lint, with opt-in passes for KubeLinter and Kubeconform. It is the fast,
first-line check that a change is well-formed.
helm-diff.sh — see what will actually change¶
./helm-diff.sh [BASE_REF] # BASE_REF defaults to origin/main
./helm-diff.sh --check # gate mode: exit non-zero if any chart shows a diff
For every applications/<app>/ chart that changed on your branch, helm-diff.sh renders the chart
both at the merge-base and in your working tree, then shows the difference between the two
rendered manifests. That is the question that matters at review time — not "did the template
change?" but "what Kubernetes objects change, and how?".
It uses dyff for a semantic YAML diff when available, and falls
back to git diff when it is not. A few behaviours are worth knowing:
- It renders from the committed dependency archives (
charts/*.tgzwithChart.lock) and builds only a dependency that is missing on one side. - It guards against the empty-render false pass: a chart that renders nothing (for example because a value file was missing) would otherwise look like "no change". The script asserts non-empty output on both sides before trusting a clean diff.
- The helmfile-rendered application (the openDesk wrapper) is skipped with a pointer — diff that
one separately with
helmfile template, old versus new.
The values-lint.yaml convention¶
Both validate.sh and helm-diff.sh render each chart standalone, outside the app-of-apps that
normally injects the cluster-wide globals. A chart whose templates read .Values.global.* therefore
needs a small dummy stub, values-lint.yaml, sitting next to its values.yaml, so it renders on its
own. If you add a chart that references globals, add that stub — otherwise the render fails with a
missing-value error. new-app.sh notes this in its scaffolded values.yaml.
ci/render-apps.sh — render exactly what Argo CD deploys¶
ci/render-apps.sh <out-dir> # every Application
ci/render-apps.sh --base origin/main <out-dir> # only the Applications your change touches, plus a diff
ci/render-apps.sh --list [--base <rev>] <out-dir> # print the selection, render nothing
Where validate.sh and helm-diff.sh render each chart standalone with its values-lint.yaml
stub, render-apps.sh starts from the app-of-apps: it renders the Application objects, then
renders each one with its own chart path, valueFiles and inline helm.values — the same
inputs Argo CD uses. A typo in a cluster override or a chart bump that renamed a values key
therefore fails here rather than at sync time. No values-lint.yaml stub is needed.
- Selection. With
--base, an Application is rendered when its renderedApplicationobject changed, or a changed file lies in its chart directory or among its value files. A change to the global values touches every Application; a change to the script or its workflow renders everything. - Validation. The rendered manifests go through kubeconform in strict mode, against the Kubernetes schemas of the cluster's minor version plus the community CRD schema catalog. Kinds without a published schema are skipped. A render error or an invalid manifest exits non-zero.
- Diff. With
--base, each selected Application is also rendered at the base revision and the unified diff of the two renders is printed — for a dependency bump this shows exactly which objects change. - Dependencies are built on every run (they are not committed). HTTPS chart repositories are registered first, as Helm 4 requires, and registry calls are retried, since public chart repositories time out now and then.
Checks on every pull request¶
The repositories run on Codeberg's hosted Forgejo Actions runners (.forgejo/workflows/). The
required checks must pass before a pull request can be merged — this includes the dependency
updates the update bot merges on its own.
| Check | Where | Required | What it does |
|---|---|---|---|
| Secret scan | all infrastructure repos | yes | Trivy fs --scanners secret, HIGH and CRITICAL fail the check |
| Render | the three GitOps repos | yes | ci/render-apps.sh --base: render the touched Applications, kubeconform, rendered diff in the job log |
| Validate | the two Ansible repos | yes | validate.sh: yamllint, ansible-lint and --syntax-check of every playbook; for the edge repo also a check that every *.sops.yml value is encrypted |
| Pages build | the two documentation sites | yes | mkdocs build --strict; on main the site is also published |
| Config scan | the three GitOps repos, main only |
no | Trivy misconfiguration scan of applications/, report only |
| Full render | the three GitOps repos, main only |
no | ci/render-apps.sh over every Application |
Report-only checks run on main only and on low-priority runners, so a queued run never holds a
pull request. The render workflow sizes its runner to the change: a small selection runs on the
smallest runner, a large one (for example after a change to the global values) on a bigger one.
Requirements¶
helm and yq are required; dyff is optional but recommended (semantic diffs are far easier to
read than line diffs). ci/render-apps.sh needs Helm 4 (the major version Argo CD uses), yq, jq,
kubeconform and git; CI runs it in the alpine/k8s image, which ships all of them. The scripts
are plain Bash and self-contained — pass --help to the root scripts for the inline usage.