# Add Helm Test Hooks to a Chart from a Linear Issue

Yes. An agent picks up the Linear issue, adds helm test pods to your chart that call the deployed services, runs helm test on a kind cluster, and opens a PR.

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

## What the agent does

The agent starts from the Linear issue and reads the chart before it adds a template. In a chart like `helm-chart/` of GoogleCloudPlatform/microservices-demo, `Chart.yaml` names `onlineboutique` at version 0.10.7 with `appVersion` v0.10.7, `templates/` holds one file per service, from `adservice.yaml` to `shippingservice.yaml`, plus `common.yaml` for the deny-all NetworkPolicy and AuthorizationPolicy, a `NOTES.txt` and no `tests/` directory. `frontend.yaml` renders a Deployment whose container listens on 8080, probes `/_healthz` with a `shop_session-id` cookie, and reads the addresses of the other services from environment variables such as `productcatalogservice:3550`, `cartservice:7070` and `checkoutservice:5050`; its Service is ClusterIP on port 80, and `frontend.externalService` adds a LoadBalancer named `frontend-external`. `values.yaml` sets `securityContext.enable` to true, so every pod runs as non-root user 1000 with a read-only root filesystem and no capabilities, and `networkPolicies.create` to false by default. `.github/workflows/helm-chart-ci.yaml` runs `helm lint --strict` and `helm template` under five value combinations and pipes each through `kustomize build`; nothing installs the chart or talks to a running release.

It adds `templates/tests/` with two hook pods, each annotated `helm.sh/hook: test` and `helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded`, rendered only when the service they call is enabled by its `create` value. The first, `test-frontend.yaml`, runs a curl image against `http://frontend:80/_healthz` with the same cookie header the probes send and then fetches `/`, failing on any non-2xx status. The second, `test-grpc.yaml`, runs a gRPC health probe against `productcatalogservice:3550` and `currencyservice:7000`, the same health service the templates already probe from inside each pod, so the check exercises the Service and DNS rather than the container alone. Both pods carry the chart's own security context block, because a test pod that runs as root would be the only such pod in the release, and both get `restartPolicy: Never`.

It also handles the policies. When `networkPolicies.create` is on, the chart's deny-all policy and per-app ingress rules admit only named apps, so the agent adds a NetworkPolicy for the test pods' label next to the hooks, guarded by the same value, and shows in `helm template` output that it renders only then. It adds a `helm test` section to `templates/NOTES.txt` and to the chart README, and extends `helm-chart-ci.yaml` with a step that templates the chart and checks the hook annotations are present, so the lint and template jobs cover the new files.

To run the hooks for real, the agent installs Docker in its sandbox with `sudo apt-get install -y docker.io` and starts `dockerd`, creates a `kind` cluster, and installs the chart with `frontend.externalService=false`, since a LoadBalancer would never get an address there, and with the load generator turned off through its `create` value so the cluster is not under load during the test. It waits for each Deployment to roll out, runs `helm test <release> --logs`, and keeps the pod logs: the curl status lines and the probe's `SERVING` answers. It then runs `helm lint --strict` and the five `helm template` invocations from the workflow to show they still pass, and opens a pull request that links the issue.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "A Linear issue labelled agent says: \"Add helm test hooks to the chart so a release can be verified with helm test after install: the frontend must answer over its Service and the gRPC services must report healthy.\" Do the work in the helm-chart directory of this repository. Read Chart.yaml, values.yaml, every file under templates, the chart README and .github/workflows/helm-chart-ci.yaml first. Add templates/tests with hook pods that curl the frontend Service's /_healthz and / with the probe cookie and run a gRPC health probe against productcatalogservice and currencyservice, each rendered only when its service is enabled, each with the chart's security context, with hook-delete-policy before-hook-creation,hook-succeeded. When networkPolicies.create is on, add a policy that lets the test pods reach the services. The sandbox has no Docker: install docker.io and start dockerd, create a kind cluster, install the chart with frontend.externalService=false and the load generator off, wait for rollout, run helm test with logs and keep them. Run helm lint --strict and the template commands from the workflow. Open a pull request that links the issue and quotes the helm test output.",
  "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

What comes back is a pull request on its own branch that adds `helm-chart/templates/tests/test-frontend.yaml`, `test-grpc.yaml` and the guarded NetworkPolicy, edits `templates/NOTES.txt`, the chart README and `.github/workflows/helm-chart-ci.yaml`, and bumps the chart `version` in `Chart.yaml` since templates changed. The description quotes the `helm test` summary with each hook's name and status, the pod logs showing the HTTP status lines and the gRPC health answers, and the `helm lint --strict` result, and it links the Linear issue.

Before merging, a reviewer checks the images the test pods use against their registry policy, since the chart's own images come from `images.repository`, whether the hooks should also run on upgrade through `post-upgrade`, and whether a `helm test` step belongs in their deployment pipeline. They also decide if the chart version bump should be minor or patch.

## Run it on every Linear issue labelled agent

In the console, an automation with a `linear` trigger on `linear.issue.labeled` and the label `agent` starts one run per labelled issue, with the issue added after the prompt, in the Project's repository. Changes made by an app integration never fire it, so the agent's own comment on the issue does not start another run. Each run reads that chart's own values and templates, so an issue about a second chart in the same repository, or one that asks for a checkout test rather than health checks, gets its own hooks and its own pull request.

From your own server, the same run is one `POST /o/{org}/sessions` per issue: put the repository in `resources` and add the issue's `https://linear.app/<workspace>/issue/<ID>` URL there too, so Rush reads it through your Linear connection into the prompt. A webhook URL on the API key reports `run.completed` or `run.failed` with the `session_url` when the turn finishes.

## Why run it on Rush?

A test hook that has never run is a YAML file with an annotation. Proving it means a cluster, a full install of every service Deployment, a wait for rollout and a `helm test` with the logs read back, which is more than a laptop review usually gets. In its own sandbox the agent installs Docker, creates a kind cluster, installs the chart and runs the hooks, and the pod logs and the test summary stay in the run's record and in the pull request.

A Linear label becomes a verified chart change on its own branch, and nothing is deployed anywhere you run. Several chart issues can run at once, each with its own cluster in its own sandbox, each ending in one pull request.

## Frequently asked questions

### Do the test pods run on every install?

No. Pods with the `helm.sh/hook: test` annotation are created only when someone runs `helm test <release>`, and with the delete policy in the templates they are removed after they succeed. `helm install` and `helm upgrade` behave exactly as before.

### Why curl the Service rather than the pod?

Because the point of the hook is to check what other services and users will reach: the `frontend` Service on port 80, its selector, and cluster DNS. The container's own readiness probe already covers the process; the hook covers the wiring around it.

### Will the hooks pass with network policies on?

Yes, through the NetworkPolicy the agent adds for the test pods' label, rendered only when `networkPolicies.create` is true. The pull request shows the `helm template` output with that value on and off so you can see the policy appear and disappear.

### Can it test a checkout flow too?

A hook can post to the frontend's checkout form and check the confirmation page, which exercises cartservice, paymentservice, shippingservice and emailservice in one go. Ask for it in a follow-up message to the same run, and the agent adds a third hook on the same pattern.

## More Helm jobs

- [Add a Horizontal Pod Autoscaler to a Helm Chart](https://getrush.ai/run/add-horizontal-pod-autoscaler/helm/)
- [Add imagePullSecrets to a Helm Chart for a Private Registry](https://getrush.ai/run/add-image-pull-secrets/helm/)
- [Add an Ingress Template to a Helm Chart](https://getrush.ai/run/add-ingress/helm/)

## More jobs like this: Turn a Linear label into a PR

- [Add a Horizontal Pod Autoscaler to an App on GKE](https://getrush.ai/run/add-horizontal-pod-autoscaler/gke/)
- [Add Horizontal Pod Autoscalers to Kubernetes Manifests from a Linear Issue](https://getrush.ai/run/add-horizontal-pod-autoscaler/kubernetes/)
- [Add Human-in-the-Loop Approval to a LangGraph Agent](https://getrush.ai/run/add-human-in-the-loop/langgraph/)

## 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/)
