Check deployment

From MinBZK/regelrecht · View interactive version

Check deployment is an AI agent skill from the GitHub repository MinBZK/regelrecht. Check if a RIG preview deployment is actually running and healthy. Verifies CI triggered, images exist, pods started, and services respond. Use when a PR deployment seems broken or after pushing code.

How to use this skill

Skill file

Check Deployment

Verify that a RIG preview deployment is actually running and healthy. Takes a PR number or deployment name as argument.

Context

A PR is built and deployed only while it carries the deploy:preview label (AGENTS.md, "Previews"). This skill is for checking if something went wrong, not for creating deployments. Common failure modes:

Instructions

1. Parse argument

Accept a PR number (e.g., 204) or deployment name (e.g., pr204, pr204b). If just a number, the deployment name is pr{N}.

2. Load RIG API key

You need the RIG_API_KEY environment variable set to access the RIG Operations Manager API.

3. Check CI/Deploy status

If a PR number is given, check if the deploy workflow ran for the latest commit:

# Get latest commit on PR
gh pr view {N} --repo NederlandseDigitaleDienst/regelrecht --json headRefOid,headRefName -q '{sha: .headRefOid, branch: .headRefName}'

# Check if deploy workflow triggered for that commit
gh run list --repo NederlandseDigitaleDienst/regelrecht --branch {branch} --workflow deploy.yml --json headSha,status,conclusion --limit 3

Report:

4. Check pod logs

Verify pods are actually running by checking for recent log output:

curl -s -H "X-API-Key: $RIG_API_KEY" \
  "https://operations-manager.rig.prd1.gn2.quattro.rijksapps.nl/api/logs/regel-k4c?deployment={name}&lines=20"

The API returns logs grouped by component. A component is deployed only when its build job ran and succeeded for this PR; the list is in .github/workflows/deploy.yml.

Empty logs for a component that was not built are expected — not a failure.

For each component in the response:

Empty logs on every component of a prN preview can also mean it is asleep (previews sleep 48 hours after their last deploy). Wake it with the zad-wake skill and check again before looking for another cause.

5. Check image availability

If pods aren't running, verify the images exist:

# Check what tags exist for this PR
for pkg in regelrecht-editor regelrecht-admin regelrecht-harvester-worker; do
  gh api --paginate "/orgs/NederlandseDigitaleDienst/packages/container/${pkg}/versions" \
    --jq ".[] | select(.metadata.container.tags | any(test(\"pr-{N}\"))) | .metadata.container.tags"
done

Important: The cluster pulls via a Harbor mirror. ghcr.io is blocked directly. Only pr-{N} tags are reliably available through Harbor. sha-{hash} tags may NOT work.

6. Report summary

Present a clear status table:

| Check | Status |

|-------|--------|

| CI/Deploy triggered | yes/no |

| Build succeeded | yes/no |

| Images exist (pr-{N} tag) | yes/no |

| editor pod running | yes/no |

| harvester-admin pod running | yes/no |

| harvester-worker pod running | yes/no |

If any check fails, explain:

7. If asked to fix

If the user asks to fix a broken deployment:

When creating a manual deployment (after user approval), use pr-{N} tags (NEVER sha- tags). Only include components whose images actually exist — check step 5 first. For frontend-only PRs, only deploy the editor:

# Frontend-only PR:
curl -s -X POST -H "X-API-Key: $RIG_API_KEY" -H "Content-Type: application/json" \
  "https://operations-manager.rig.prd1.gn2.quattro.rijksapps.nl/api/projects/regel-k4c/:upsert-deployment" \
  -d '{"deploymentName": "{name}", "cloneFrom": "regelrecht", "components": [
    {"reference": "editor", "image": "ghcr.io/nederlandsedigitaledienst/regelrecht-editor:pr-{N}"}
  ]}'

# PR with backend changes (all three images exist):
curl -s -X POST -H "X-API-Key: $RIG_API_KEY" -H "Content-Type: application/json" \
  "https://operations-manager.rig.prd1.gn2.quattro.rijksapps.nl/api/projects/regel-k4c/:upsert-deployment" \
  -d '{"deploymentName": "{name}", "cloneFrom": "regelrecht", "components": [
    {"reference": "editor", "image": "ghcr.io/nederlandsedigitaledienst/regelrecht-editor:pr-{N}"},
    {"reference": "harvester-admin", "image": "ghcr.io/nederlandsedigitaledienst/regelrecht-admin:pr-{N}"},
    {"reference": "harvester-worker", "image": "ghcr.io/nederlandsedigitaledienst/regelrecht-harvester-worker:pr-{N}"}
  ]}'

Then wait 60-90 seconds and verify pods started via logs. Do NOT report success until logs confirm pods are running.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.