{"slug": "test-coding-agent-pull-requests-with-argo-cd-and-signadot", "title": "Test Coding Agent Pull Requests with Argo CD and Signadot", "summary": "A Signadot tutorial demonstrates wiring Argo CD and Signadot sandboxes so that every pull request opened by a coding agent gets its own preview environment, with the agent reading test results back through the read-only Argo CD MCP server. An ApplicationSet turns each labeled pull request into an Application whose hooks create a sandbox for the changed service, run the PR's Playwright suite, and delete the sandbox on close, while Argo CD Notifications reports an `argocd/preview` commit status. The agent is blocked from kubectl, argocd and signadot access and can only push fixes based on preview results.", "body_md": "*Read this tutorial on [Signadot docs](https://www.signadot.com/docs/tutorials/argocd-coding-agent-pull-requests?utm_source=devto&utm_medium=referral&utm_campaign=argocd-tutorial).*\n\nCoding agents open pull requests faster than anyone can test them by hand. If you already run Argo CD, it can give each of those pull requests a preview of its own, and the [Argo CD preview environments](https://www.signadot.com/articles/argocd-preview-environments?utm_source=devto&utm_medium=referral&utm_campaign=argocd-tutorial) article explains why a Signadot [sandbox](https://www.signadot.com/docs/concepts/sandbox?utm_source=devto&utm_medium=referral&utm_campaign=argocd-tutorial) beats a full copy of the app for that.\n\nThis tutorial builds the whole loop. A coding agent changes [HotROD](https://github.com/signadot/hotrod), a demo ride-sharing app, and opens a pull request. An Argo CD ApplicationSet turns the pull request into an Application whose hooks create a sandbox for the changed `route` service, run the pull request's Playwright suite against it, and delete the sandbox when the pull request closes. Argo CD Notifications reports the result as an `argocd/preview` check. When the check fails, the agent reads why through the read-only [Argo CD MCP server](https://github.com/argoproj-labs/mcp-for-argocd), pushes a fix and waits for the next result.\n\n**Time:** about 40 minutes.\n\n**Example files:** [signadot/examples/argocd-tutorial](https://github.com/signadot/examples/tree/main/argocd-tutorial)\n\n**Tip: What the agent can and can't do**\n\nThe agent pushes commits and reads Argo CD. It needs no kubeconfig and no Signadot API key, and the repository's Claude Code settings block `kubectl`, `argocd` and `signadot`. It can't sync or change anything in Argo CD, and its Argo CD account sees only preview Applications. The preview is its only way to test end to end.\n\nEach piece does one job:\n\n| Piece | Job | \n|---|---|\n| GitHub Actions | Builds `ghcr.io/<owner>/hotrod:<head sha>` for every commit on a pull request labeled`preview` . | \n| ApplicationSet | Creates one Application, `hotrod-pr-<number>` , for every open pull request with the`preview` label, and deletes it when the pull request closes. | \n| Preview chart | A ConfigMap with the sandbox specification and three hook Jobs: Sync creates or updates the sandbox, PostSync runs the tests, PostDelete deletes the sandbox. | \n| Signadot | The sandbox runs the pull request's image in place of `route` for requests that carry its routing key. Everything else comes from the baseline. | \n| Argo CD Notifications | Sets the `argocd/preview` commit status: pending when a sync starts, then success or failure. | \n| Argo CD MCP server | Lets the agent read the Application's status, events and hook logs, and nothing else. | \n\nArgo CD doesn't build anything here. It does what it already does for the baseline, reconciling what Git says should exist, plus one post-deploy test. The [Argo CD integration guide](https://www.signadot.com/docs/guides/integrate-ci/argocd?utm_source=devto&utm_medium=referral&utm_campaign=argocd-tutorial) compares this with letting CI run the tests.\n\nThe preview chart lives in the examples repository, not in HotROD, so an agent's pull request can't change how its own preview is created or tested. It controls only its code and its Playwright tests.\n\n`~/.signadot/config.yaml`:\n\n```\n  local:\n    connections:\n      - cluster: <your-signadot-cluster>\n        kubeContext: <your-kube-context>\n        type: PortForward\n```\n\n`argocd`, `gh` and `kubectl` CLIs, and Node.js for `npx`.\nThe steps below pin Argo CD v3.5.6 and argocd-mcp 0.9.0.\n\nThe agent works in your fork of HotROD, so its pull requests and images are yours. Clone the examples repository next to it and copy the preview files into the fork:\n\n```\nexport OWNER=<your-github-user>   # lowercase\ngit clone https://github.com/signadot/examples.git\ngh repo fork signadot/hotrod --clone\ncd hotrod\ngh repo set-default $OWNER/hotrod\ncp -R ../examples/argocd-tutorial/hotrod/. .\ngit rm -q .github/workflows/build.yml\ngit add -A && git commit -m \"Add Argo CD previews\" && git push origin main\ngh label create preview\n```\n\n`gh repo fork --clone` makes the upstream repository the default for `gh`. Without `gh repo set-default`, the agent's `gh pr create` would open its pull request on `signadot/hotrod`, where your ApplicationSet never sees it. HotROD's own `build.yml` needs Signadot's secrets, so the fork drops it.\n\nThe copied files:\n\n| File | Purpose | \n|---|---|\n| `.github/workflows/preview-image.yaml` | Builds and pushes the image for each commit on a `preview` pull request. | \n| `AGENTS.md` and`CLAUDE.md` | Tell the agent how previews work and which MCP tools to call when one fails. `CLAUDE.md` imports`AGENTS.md` . | \n| `.mcp.json` | Starts the Argo CD MCP server with `MCP_READ_ONLY=true` . | \n| `.claude/settings.json` | Denies Claude Code `kubectl` ,`argocd` and`signadot` . | \n\nThe workflow triggers on `labeled`, `synchronize` and `reopened`. GitHub sends a `labeled` event for labels set when a pull request is opened, so each commit is built once:\n\n**hotrod/.github/workflows/preview-image.yaml (excerpt)**\n\n```\non:\n  pull_request:\n    types: [labeled, synchronize, reopened]\n\njobs:\n  build:\n    if: >-\n      github.event.action == 'labeled' && github.event.label.name == 'preview' ||\n      github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'preview')\n```\n\nOpen your fork's **Actions** tab and enable workflows. GitHub disables them on new forks.\n\n```\nkubectl create namespace argocd\nkubectl apply -n argocd --server-side --force-conflicts \\\n  -f https://raw.githubusercontent.com/argoproj/argo-cd/v3.5.6/manifests/install.yaml\n\nkubectl create namespace hotrod-previews\nkubectl -n hotrod-previews create secret generic signadot \\\n  --from-literal=SIGNADOT_ORG=<your-org> --from-literal=SIGNADOT_API_KEY=<your-api-key>\nkubectl -n argocd patch secret argocd-notifications-secret \\\n  -p '{\"stringData\": {\"github-token\": \"<your-github-token>\"}}'\n```\n\nThe preview's hook Jobs run in `hotrod-previews` and read the Signadot key from the `signadot` secret. The GitHub token lets the ApplicationSet list your pull requests and Argo CD Notifications set commit statuses. Create a fine-grained token for your fork with **Commit statuses: Read and write** and **Pull requests: Read**.\n\n```\nexport CLUSTER=<your-signadot-cluster>\ncd ../examples/argocd-tutorial\nsed -i.orig -e \"s/<owner>/$OWNER/g\" -e \"s/<cluster>/$CLUSTER/g\" argocd/*.yaml\nkubectl apply --server-side --field-manager=argocd-tutorial -f argocd/\nkubectl -n argocd get applications\nNAME     SYNC STATUS   HEALTH STATUS\nhotrod   Synced        Healthy\n```\n\nThis applies three files:\n\n`hotrod.yaml` deploys HotROD from your fork's `main` branch, with the Signadot DevMesh sidecar, into the `hotrod` namespace. If HotROD already runs there, Argo CD adopts it.`previews.yaml` holds the `previews` AppProject and the ApplicationSet.`config.yaml` adds the agent's account and the notification settings. The separate field manager keeps the defaults the Argo CD install put in `argocd-cm`; with the default The ApplicationSet polls GitHub every minute, because no webhook can reach a local cluster. Each Application renders the preview chart with the pull request's number and head commit:\n\n**argocd/previews.yaml (excerpt)**\n\n```\n  generators:\n    - pullRequest:\n        github:\n          owner: <owner>\n          repo: hotrod\n          labels:\n            - preview\n          tokenRef:\n            secretName: argocd-notifications-secret\n            key: github-token\n        requeueAfterSeconds: 60\n  template:\n    metadata:\n      name: hotrod-pr-{{ .number }}\n    spec:\n      project: previews\n      source:\n        repoURL: https://github.com/signadot/examples.git\n        targetRevision: main\n        path: argocd-tutorial/preview\n        helm:\n          valuesObject:\n            pr: \"{{ .number }}\"\n            headSha: \"{{ .head_sha }}\"\n            image: ghcr.io/<owner>/hotrod:{{ .head_sha }}\n            # ...\n      syncPolicy:\n        automated:\n          prune: true\n        retry:\n          limit: 0\n```\n\nTwo settings matter for agent feedback:\n\n`retry.limit: 0`.\nThe sandbox specification forks only `route` and runs the pull request's image:\n\n**preview/templates/sandbox.yaml (rendered)**\n\n```\nname: hotrod-pr-323\nspec:\n  cluster: <your-signadot-cluster>\n  description: HotROD pull request 323\n  ttl:\n    duration: 3d\n    offsetFrom: updatedAt\n  forks:\n  - forkOf:\n      kind: Deployment\n      namespace: hotrod\n      name: route\n    customizations:\n      images:\n      - image: ghcr.io/<owner>/hotrod:<head sha>\n  defaultRouteGroup:\n    endpoints:\n    - name: frontend\n      target: http://frontend.hotrod.svc:8080\n```\n\nKeep the description the same for every commit: Signadot rejects updates that change it. The TTL is a backstop in case the PostDelete hook never runs.\n\nThe hooks:\n\n`hotrod-pr-<number>-sandbox`). Container `wait-for-image` uses `crane` to wait until CI has pushed the image. Container `signadot` then runs `signadot sandbox apply` and waits for the sandbox to be ready.`hotrod-pr-<number>-e2e`). Init container `routing-key` looks up the sandbox's routing key. It is the only container in this Job that holds the Signadot API key, and it fails the Job if no key comes back, so the tests never run against the baseline by mistake. Container `e2e` fetches the pull request's head commit and runs `npm run e2e:playwright` with `SIGNADOT_ROUTING_KEY` set.`hotrod-pr-<number>-cleanup`). Runs `signadot sandbox delete` after the ApplicationSet deletes the Application.\nThe `previews` AppProject allows only ConfigMaps, Jobs and Pods, and only in `hotrod-previews`. Pods are listed so that Argo CD shows the hook Jobs' Pods, which is where it reads their logs.\n\n```\nsignadot local connect\nargocd login argocd-server.argocd.svc --insecure --username admin \\\n  --password \"$(argocd admin initial-password -n argocd | head -1)\"\nexport ARGOCD_API_TOKEN=$(argocd account generate-token --account agent --expires-in 24h)\nargocd logout argocd-server.argocd.svc --insecure\n```\n\n`signadot local connect` makes in-cluster addresses such as `argocd-server.argocd.svc` resolve on your machine. The Argo CD UI is at `https://argocd-server.argocd.svc`. Logging out keeps your admin session out of the shell the agent runs in.\n\nThe `agent` account comes from `config.yaml`. It has an API key and no login, and its RBAC allows reading preview Applications and their logs:\n\n**argocd/config.yaml (excerpt)**\n\n```\n  accounts.agent: apiKey\n---\n  policy.csv: |\n    p, agent, applications, get, previews/*, allow\n    p, agent, logs, get, previews/*, allow\n```\n\n`.mcp.json` passes the token to the MCP server and turns on read-only mode, which removes the create, update, delete, sync and resource-action tools:\n\n**hotrod/.mcp.json**\n\n```\n{\n  \"mcpServers\": {\n    \"argocd\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"argocd-mcp@0.9.0\", \"stdio\"],\n      \"env\": {\n        \"ARGOCD_BASE_URL\": \"${ARGOCD_BASE_URL:-https://argocd-server.argocd.svc}\",\n        \"ARGOCD_API_TOKEN\": \"${ARGOCD_API_TOKEN}\",\n        \"MCP_READ_ONLY\": \"true\",\n        \"NODE_TLS_REJECT_UNAUTHORIZED\": \"0\"\n      }\n    }\n  }\n}\n```\n\nThis Argo CD uses a self-signed certificate, so `--insecure` and `NODE_TLS_REJECT_UNAUTHORIZED=0` skip verification. Drop both once Argo CD has a trusted certificate.\n\n```\ncd ../../hotrod\nclaude\n```\n\nApprove the `argocd` MCP server from `.mcp.json`, then give it the task from [` prompt.md`](https://github.com/signadot/examples/blob/main/argocd-tutorial/prompt.md):\n\n```\nIn the route service, make the \"Resolving routes\" notification show the ETA that route computed,\nfor example \"Resolving routes (ETA 12m30s)\". Open a pull request for it and don't stop until its\npreview passes. Then tell me the PR URL, the preview URL and what you checked.\n```\n\nIn our run, Claude Code found the notification in `services/route/server.go` and the Playwright test that asserts its text, and changed both:\n\n```\n-           Body:      \"Resolving routes\",\n+           Body:      fmt.Sprintf(\"Resolving routes (ETA %s)\", eta),\n-       ).toHaveText(\"Resolving routes\")\n+       ).toHaveText(/^Resolving routes \\(ETA (\\d+h)?(\\d+m)?\\d+s\\)$/);\n```\n\nIt opened the pull request with `gh pr create --label preview` and waited with `gh pr checks --watch`. Within a minute, the ApplicationSet created `hotrod-pr-323` and the check turned pending. The Sync hook waited for the image:\n\n```\nwaiting for CI to push ghcr.io/<owner>/hotrod:<head sha>: Error: GET https://ghcr.io/v2/<owner>/hotrod/manifests/<head sha>: MANIFEST_UNKNOWN: manifest unknown\n```\n\nThe image build took under two minutes. Then the Sync hook created the sandbox and the PostSync hook ran the pull request's tests against it:\n\n```\nTesting 6651b6c22905f7543e15ef683033570a444ff956 in sandbox hotrod-pr-323 (routing key ttdg1bpt6cgcj)\n\nRunning 2 tests using 1 worker\n\n  ✓  1 [chromium] › basic.spec.ts:4:6 › Request a ride › check route resolve routes (2.7s)\n  ✓  2 [chromium] › basic.spec.ts:17:6 › Request a ride › check driver series (2.5s)\n\n  2 passed (6.7s)\n```\n\nAbout two and a half minutes after the push, `argocd/preview` passed. The agent then called `get_application_workload_logs` on the e2e Job to confirm the run tested its own commit, and put the preview URL in the pull request description.\n\nThe first image build creates the package `ghcr.io/<owner>/hotrod`. If GitHub makes it private, the Sync hook keeps logging `DENIED` after the build succeeds. HotROD is open source, so make the package public in its **Package settings**, and the preview continues on its own. Keep images of your own services private; see [Use it with your own services](https://www.signadot.com/docs/tutorials/argocd-coding-agent-pull-requests?utm_source=devto&utm_medium=referral&utm_campaign=argocd-tutorial#use-it-with-your-own-services).\n\nA passing first try doesn't show the loop's real value, so break the preview the way a teammate might. `driver` gives each `route` call a one-second deadline (`services/route/client.go`). Once the agent is done, in a second terminal in `hotrod`, with the agent's branch checked out, push a commit that makes `route` slower than that:\n\n```\nperl -pi -e 's/50 \\* time\\.Millisecond/1500 * time.Millisecond/' pkg/config/route.go\ngit commit -am \"route: simulate a slower routing engine\" && git push\n```\n\nThe change builds and passes unit tests. In the preview, `driver` gives up on every route lookup, no ride gets a driver, and both Playwright tests fail:\n\n```\n    Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected)\n\n    Locator: locator('//div[p[2][contains(text(), 'driver')]]/p[4]').last()\n    Expected pattern: /.*T7\\d{5}C.*/\n    Received string:  \"Finding an available driver\"\n```\n\nTell the agent:\n\n```\nThe argocd/preview check on <PR URL> has been failing since a teammate pushed a commit to your\nbranch. Find out why, fix it, and don't stop until the preview passes.\n```\n\nIn our run, the agent checked the pull request with `gh pr checks`, then called `get_application` for `hotrod-pr-323` and `get_application_workload_logs` for its e2e Job. It read the teammate's commit and the `route` client code, found the one-second deadline, and pushed a revert:\n\n```\nRevert \"route: simulate a realistic routing engine (1.5s per calculation)\"\n\nThis reverts commit 31cdf11. The driver service calls FindRoute with a\n1s deadline (services/route/client.go), so a 1.5s calculation makes every\nroute lookup fail: dispatch never completes and no route notification is\nstored. A slower routing engine needs the client deadline raised first,\nin a change that also redeploys driver.\n```\n\nThe check passed less than two minutes after its push. The agent also explained why raising the timeout in the pull request wouldn't help: the timeout runs in `driver`, and the preview forks only `route`.\n\nThe `argocd/preview` check links to the preview URL, `https://frontend--hotrod-pr-<number>.preview.signadot.com`. Open it while signed in to Signadot and request a ride. The `route` notification shows the ETA, because the preview URL adds the sandbox's routing key to your requests. Dispatching one ride with the routing key and one without shows the difference in the `route` notification:\n\n```\nhotrod-pr-323 | Resolving routes (ETA 21m27s)\nbaseline      | Resolving routes\n```\n\nMerge or close the pull request. On its next poll, the ApplicationSet deletes `hotrod-pr-<number>`, the PostDelete hook deletes the sandbox, and `signadot sandbox list` no longer shows it. In our runs this took about a minute.\n\nClose any open `preview` pull requests first, so their hooks can delete their sandboxes. Then, from `examples/argocd-tutorial`:\n\n```\nkubectl delete -f argocd/\nkubectl delete namespace hotrod-previews argocd\n```\n\nHotROD keeps running in `hotrod`.\n\n`targetRevision` to a commit or tag.`preview` to a pull request gets that pull request's code and tests run in your cluster.`services` value lists the Deployments the sandbox forks. All of HotROD's services share one image; for your services, give each fork its own image.`ghcr.io/<owner>/hotrod` is public only because HotROD is open source. Push your own services' images to a private registry the cluster can pull from. If pulling needs credentials, add an `imagePullSecrets` `DOCKER_CONFIG` pointing at it.`waiting for CI to push ...`.` MANIFEST_UNKNOWN`, the image isn't there yet: check that Actions is enabled in your fork and that the `Preview image` run succeeded. With `DENIED` after a successful run, the package is private: make it public for HotROD, or give `argocd/preview` check.`kubectl -n argocd logs deploy/argocd-notifications-controller` shows GitHub's answer.`get_application_workload_logs` returns `[]`.` Pod` in the `cannot update description`.` signadot/hotrod`: run `gh repo set-default $OWNER/hotrod` in the clone.\nNo. The agent pushes commits to Git and reads Argo CD through the read-only Argo CD MCP server, as a local account that can only get Applications in the previews project and their logs. The Signadot API key stays in a Kubernetes secret that only the preview's hook Jobs use, and the containers that run the pull request's own code never see it.\n\nOnly partly. GitHub Actions still builds the image for each commit. Argo CD manages the preview's lifecycle and runs the end-to-end tests as a PostSync hook, next to the sandbox in the cluster, so CI needs no network path to the cluster and the agent reads the result where it already looks. If your tests already live in CI, Argo CD can manage only the sandbox and CI can run the tests; the Argo CD integration guide compares the options.\n\nA Signadot sandbox runs only the services a pull request changes, here route, and routes requests that carry its routing key to them. Everything else, including Kafka, MySQL and Redis, comes from the baseline Argo CD already manages. Each preview adds one pod instead of a copy of the app, which keeps previews cheap enough to give to every agent pull request.\n\nNo. Forked workloads carry no Argo CD tracking annotation, and they are owned by Signadot objects rather than being top-level resources, so Argo CD neither tracks, prunes nor reports them as orphaned. In this tutorial the baseline hotrod Application stayed Synced and Healthy while previews ran.\n\nYes. Any agent that can push to Git and call an MCP server can follow the same loop. `AGENTS.md` in the repository holds the instructions, and the Argo CD MCP server runs over stdio with npx. The `.claude/settings.json` deny rules are specific to Claude Code; give other agents an equivalent restriction.\n\nThe ApplicationSet, chart and notifications are standard Argo CD, but this tutorial was tested on open source Argo CD. On Akuity Platform, TokenRef strict mode is on by default, so point the generator's tokenRef at the platform-managed application-set-secret, and agents can use the Akuity MCP Server, which is read-only by default. See the Argo CD integration guide.", "url": "https://wpnews.pro/news/test-coding-agent-pull-requests-with-argo-cd-and-signadot", "canonical_source": "https://dev.to/signadot/test-coding-agent-pull-requests-with-argo-cd-and-signadot-12nk", "published_at": "2026-11-16 18:41:43+00:00", "updated_at": "2026-11-16 18:52:09.805283+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "mlops", "agent-protocols"], "entities": ["Signadot", "Argo CD", "HotROD", "GitHub Actions", "Playwright", "Argo CD MCP server", "Claude Code"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/test-coding-agent-pull-requests-with-argo-cd-and-signadot", "markdown": "https://wpnews.pro/news/test-coding-agent-pull-requests-with-argo-cd-and-signadot.md", "text": "https://wpnews.pro/news/test-coding-agent-pull-requests-with-argo-cd-and-signadot.txt", "jsonld": "https://wpnews.pro/news/test-coding-agent-pull-requests-with-argo-cd-and-signadot.jsonld"}}