# Add Kubeconform Validation to CI for an Argo CD Repo

Yes. An agent renders every app in an Argo CD repository the way Argo CD would, validates the output with kubeconform and the Argo CRD schemas in CI, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-kubeconform-to-ci/argo-cd/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent clones the repository into its own cloud sandbox and reads how each application is rendered, because an Argo CD repo holds several tools side by side and each needs its own render step before anything can be validated. In a repository like argoproj/argocd-example-apps there is no `.github/` directory at all, and the `README.md` table lists the directories: `guestbook` as plain YAML, `kustomize-guestbook` with a `namePrefix`, `pre-post-sync` as a Kustomization whose deprecated `bases` key points at `../kustomize-guestbook` and adds two hook `Job`s, `sync-waves` as one multi-document file of hooks and `ReplicaSet`s, `helm-guestbook` as an `apiVersion: v2` chart with a `values-production.yaml`, `helm-dependency` as a chart whose only content is a `wordpress` dependency from `https://charts.helm.sh/stable`, `helm-hooks` with Helm hook annotations, `blue-green` as a chart rendering an Argo Rollouts `Rollout`, `apps` as a chart that renders one `Application` per entry in `values.yaml`, `applicationset` with one `ApplicationSet` per generator including `appset-any-ns-invalid.yaml`, which is broken on purpose, two jsonnet directories, one taking top-level arguments, `sock-shop` as a Kustomization listing twenty-nine files including a `networking.k8s.io/v1` `Ingress`, `lightweight` as two `ConfigMap`s, and `plugins` for config management plugins that only an Argo CD server can render. Across the tree, `apiVersion` is `v1` and `apps/v1` for most objects, `argoproj.io/v1alpha1` for fourteen, and `batch/v1` for the hook jobs.

The workflow renders each directory with the tool Argo CD would pick. The agent writes `.github/workflows/validate.yml` with a job that installs pinned releases of `kubeconform`, `kustomize`, `helm` and `jsonnet`, then runs a script that validates plain directories directly, pipes `kustomize build` output for the Kustomizations, runs `helm template` with the default values and once more with each `values-*.yaml` for the charts, runs `helm dependency build` first for `helm-dependency`, and renders the jsonnet files with `jsonnet`, passing a top-level argument for the `tla` variant as its README describes. Every stream goes into `kubeconform -strict -summary -kubernetes-version <version>` with two schema locations: `default` for core kinds, and the CRDs catalog path pattern for `argoproj.io`, so `Application`, `ApplicationSet` and `Rollout` are checked against their schemas instead of skipped. The job runs across a small matrix of Kubernetes versions, the oldest and newest the team runs. `plugins` is listed as skipped with the reason, and `appset-any-ns-invalid.yaml` is validated on its own with the result expected to fail, so the job proves the check sees a broken manifest.

Reading the tree turns up findings the workflow will surface, and the agent lists them rather than fixing them silently: `kustomize build` prints a deprecation warning for the `bases` key in `pre-post-sync`, the `charts.helm.sh/stable` repository that `helm-dependency` points at has been retired, so that chart's render is marked as allowed to fail with a note, and `kustomize-guestbook/guestbook-ui-svc.yaml` has a trailing tab after `apiVersion: v1` that `yamllint` would flag. It proves the job in the sandbox by running the script end to end and recording the summary line per directory, then introducing a wrong field in `guestbook/guestbook-ui-deployment.yaml` to show the exact error `-strict` prints, before reverting it.

The pull request carries the workflow, the render script under `hack/` so a maintainer can run the same check locally, and a `README.md` line under the table saying what CI validates. Nothing in any application directory changes.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add manifest validation to CI for this Argo CD repository. Read README.md and every application directory first, and classify each by how Argo CD renders it: plain YAML, Kustomize, Helm, jsonnet or a config management plugin. Write a GitHub Actions workflow that installs pinned kubeconform, kustomize, helm and jsonnet, renders each directory with its tool, including each chart's extra values files and the jsonnet top-level arguments, and validates the output with kubeconform in strict mode against a matrix of the oldest and newest Kubernetes versions this repository should support, with the default schemas plus the CRDs catalog for the argoproj.io kinds. Skip the plugin directories and say why; validate the intentionally invalid ApplicationSet separately and expect it to fail. Put the render script under hack/ so it runs locally. Run it in your sandbox, record the summary per directory, break one manifest to show the error, revert it, and open a pull request listing what each directory rendered with, the warnings you saw, and anything you left alone.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

A pull request that adds `.github/workflows/validate.yml` and `hack/validate.sh`, and one line in `README.md`. The description lists each directory with the tool it renders through, the kubeconform summary per directory and Kubernetes version, the deliberate failure's output, the retired chart repository and the deprecation warning as findings, and the directories skipped with the reason.

A reviewer checks the Kubernetes versions in the matrix, decides whether the retired chart should be fixed or dropped, and merges. From then on a pull request that misspells a field in a `Deployment`, renders a `Rollout` against the wrong schema, or breaks a chart's values file fails before Argo CD ever tries to sync it.

## Run it on every terminal hand-off

An operator who has just watched a sync fail on a typo starts this from the terminal with this body and the repository in `resources`, and goes back to the incident. The run reads every directory and its README, so each application is rendered the way Argo CD renders it rather than through one generic step that would miss the charts and the jsonnet.

Send a `request_id`, a UUID, with the body so a retried start returns the run it already began. When the turn ends, `GET /o/{org}/sessions/{id}` names the pull request, and a follow-up to the same session can ask for an `argocd app diff` step against a live server, or for `conftest` policies on top of the schema check.

## Why run it on Rush?

The work is less about kubeconform than about rendering a dozen directories faithfully, and the only way to know a script does that is to run it against every one of them and read the summaries. The agent does that in its own sandbox and keeps every render, every summary and the deliberate failure in the run's record, so the pull request shows which directory would have caught what rather than describing a job.

The same run fits any GitOps repository: a Flux tree where `flux build kustomization` renders the overlays, a Helm-only repo where each chart's `ci/` values files are the matrix, or a monorepo of `Application` manifests where the CRD schemas are the whole point. Each gets a workflow derived from how its own applications are built.

## Frequently asked questions

### Why render instead of validating the files as they are?

Argo CD never applies a chart or a Kustomization as written; it renders it first. A values file that produces an invalid field, or a patch that drops a required key, is only visible in the rendered output, so the job validates what the cluster would receive.

### How are the Argo CD kinds checked?

Kubeconform's default schemas cover built-in kinds only, so a second `-schema-location` points at the CRDs catalog's path pattern, which holds `Application`, `ApplicationSet` and `Rollout` schemas by group, kind and version. Without it those documents would be skipped or, in strict mode, reported as having no schema.

### What about the config management plugin directories?

They are rendered by a plugin sidecar inside the Argo CD server, so there is no local tool that produces the same output. The job lists them as skipped with that reason, and a follow-up can run the plugin's own command if it is available as a binary.

### Will the intentionally broken ApplicationSet fail the job?

It is validated in its own step whose failure is the expected result, so the job stays green while proving the check reads it. If the file is ever fixed, that step starts failing in the other direction and the comment in the script says why.

## More Argo CD jobs

- [Post a Rendered Manifest Diff on Every PR to an Argo CD Repository](https://getrush.ai/run/add-manifest-diff-to-ci/argo-cd/)
- [Add Pod Disruption Budgets to Argo CD Applications](https://getrush.ai/run/add-pod-disruption-budgets/argo-cd/)
- [Add Slack Notifications to Argo CD Applications](https://getrush.ai/run/add-slack-notifications/argo-cd/)

## The same job on other stacks

- [Add Kubeconform Validation to CI for a Helm Chart](https://getrush.ai/run/add-kubeconform-to-ci/helm/)
- [Validate Every Kustomize Build With kubeconform in CI](https://getrush.ai/run/add-kubeconform-to-ci/kustomize/)

## More jobs like this: Hand off a long task

- [Split Kubernetes Manifests into Kustomize Overlays for Dev and Prod](https://getrush.ai/run/add-kustomize-overlays/kubernetes/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
