All jobs

Add Skaffold Verify Tests After a Deploy

Yes. An agent adds a verify section to skaffold.yaml with in-cluster checks of the deployed frontend, wires skaffold verify into the PR workflow and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads how the app is built and deployed. In a repository laid out like GoogleCloudPlatform/microservices-demo, skaffold.yaml holds two skaffold/v3 configs: app, with eleven artifacts from src/emailservice through src/adservice, a gitCommit tag policy, local builds with the Docker CLI and BuildKit, Kustomize manifests from kubernetes-manifests, kubectl deploy, and three profiles, gcb for Cloud Build, debug that swaps the cart service's Dockerfile, and network-policies that adds the Kustomize component; and loadgenerator, which requires the first. Nothing in either config runs after the deploy. .github/workflows/deploy-pr.yaml fills that gap by hand: skaffold run ... -p network-policies into a pr<N> namespace, twelve kubectl wait lines, then a Smoke Test that deletes the load generator pod and scrapes its logs for an Aggregated line with no errors. docs/development-guide.md tells a developer to use skaffold run and find the frontend's IP in a browser, with no check in between.

Skaffold has a place for exactly these checks. The agent adds a verify section to the app config with a few named test containers that run in the cluster: one that curls http://frontend/_healthz, the handler src/frontend/main.go registers to answer ok, one that fetches / and one that fetches /product/<id> for an id from src/productcatalogservice/products.json, each with --fail so a non-2xx fails the container. Each test uses executionMode set to the Kubernetes cluster, so the container runs as a Job in the same namespace and reaches the frontend ClusterIP service on port 80 from kubernetes-manifests/frontend.yaml by name, which also means it works against a kind or minikube cluster from the development guide with no external address. skaffold verify then runs them after skaffold run or skaffold deploy, and skaffold dev is unaffected.

The network-policies profile is the trap the agent checks before claiming anything. kustomize/components/network-policies/network-policy-deny-all.yaml selects every pod and denies ingress and egress, and network-policy-frontend.yaml allows all ingress and egress for pods labelled app: frontend, so a verify Job can reach the frontend, but the Job's own pod matches deny-all and no other policy, and its egress is blocked. The agent adds a small policy to the component for pods carrying the label Skaffold puts on verify Jobs, allowing egress to the frontend pods, and builds the component with kubectl kustomize to show it renders, which .github/workflows/kustomize-build-ci.yaml also does on the branch.

In the workflow, a skaffold verify --namespace=$NAMESPACE step goes between Wait For Pods and the existing Smoke Test, with the same --default-repo and tag as the skaffold run line so the verify images resolve the same way. The loadgenerator smoke test stays, since it exercises the checkout path a curl does not. For proof the agent brings up a kind cluster in the sandbox, which needs Docker installed with sudo apt-get install -y docker.io and dockerd started, runs skaffold run against it, then skaffold verify, and quotes the per-test lines; it repeats the verify step with -p network-policies so the new policy is shown to be what makes it pass. Building eleven images in the sandbox takes a while, and the agent says how long in the pull request rather than skipping it.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Add Skaffold verify tests after the deploy. Read skaffold.yaml, .github/workflows/deploy-pr.yaml, docs/development-guide.md, src/frontend/main.go, kubernetes-manifests/frontend.yaml, kustomize/components/network-policies/network-policy-deny-all.yaml and network-policy-frontend.yaml first. Add a verify section to the app config with in-cluster containers that curl the frontend's /_healthz, / and one /product/<id> page by service name, with --fail. Add a network policy to the network-policies component that lets the verify pods reach the frontend, and check it with kubectl kustomize. Add a skaffold verify step to deploy-pr.yaml after Wait For Pods, keeping the existing smoke test. Prove it on a kind cluster in the sandbox with and without the network-policies profile, quote the output and open a pull request.",
  "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 that changes skaffold.yaml and .github/workflows/deploy-pr.yaml, adds one file to kustomize/components/network-policies/ and lists it in that component's kustomization.yaml, and adds a short paragraph to docs/development-guide.md telling a developer to run skaffold verify after skaffold run. The service code, the base manifests and the load generator are untouched.

The description holds the skaffold verify output from the sandbox cluster, once with the default manifests and once with -p network-policies, the kubectl kustomize render of the component showing the new policy, and the time the local build took so a reviewer knows what to expect. The repository's kustomize-build-ci workflow runs on the branch because the component changed, and the pull request workflow runs the unit tests.

Before merging, a reviewer decides whether the loadgenerator-based smoke test should be retired now that verify covers the page loads, and whether a gRPC health probe against productcatalogservice belongs in the same section. The agent keeps the smoke test and names the probe as a follow-up.

Run it on every repository that deploys with Skaffold and checks nothing after

A platform team with several Skaffold-deployed services starts one run per repository with POST /o/{org}/sessions, this prompt as input and the repository in resources. Each run reads its own skaffold.yaml and manifests, so a service with one image gets one verify container against its own health path, a repository with network policies gets the policy that lets the checks through, and one with no workflow gets the verify section and a line in its docs only.

Give each request a request_id that is a UUID v5 of the repository's full name so a retried call returns the run it already started, and read each pull request from the session_url the key's webhook_url delivers when the run finishes.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

A verify section is only trusted after it has run against a real cluster, with and without the network policies that could block it, and that means Docker, kind, eleven image builds and two deploys, which few people do on a laptop for a YAML change. The sandbox does all of it and keeps the output, so the pull request opens with both verify runs quoted.

The run's record shows each container's output and the policy that made the second run pass, so a reviewer reads cause and effect rather than a claim. Across a company's Skaffold repositories the same request runs at once, one sandbox each, with each pull request fitted to that repository's own services and policies.

Frequently asked questions

Why run the checks inside the cluster rather than from the runner?

The workflow already waits for frontend-external to get an address, but a developer on kind or minikube has no load balancer. A verify container that runs as a Job in the namespace reaches frontend by service name in both places, so the same skaffold.yaml works for CI and for the development guide.

Does `skaffold dev` or `skaffold run` now run the tests automatically?

No. verify is its own command, so skaffold run deploys as before and skaffold verify runs the section afterwards. The workflow calls both, and the development guide gains one line telling a developer to do the same.

What happens with the network-policies profile?

The component's deny-all policy blocks the verify Job's egress, so without a change the checks time out only in that profile. The pull request adds a policy for the verify pods and shows the run passing under -p network-policies, which is the profile the workflow uses.

Why keep the load generator smoke test?

The verify containers load pages; the load generator also posts to /cart and /cart/checkout, which exercises the cart, currency, shipping, payment and email services behind the frontend. The agent leaves that step in and names retiring it as a decision for the reviewer.

More jobs like this: Hand off a long task

Keep reading