agentleFS
Atou4Atou4/skillsmith/skills/devops/gcp-cloud-run-ops/SKILL.md

gcp-cloud-run-ops

Skill3 starsChanged 11 days agoMITView on GitHub

Deploy, verify, roll back and diagnose Google Cloud Run services safely: image by digest, revisions created without traffic, traffic shifted only after they start, tags cleared, a read-only post-deploy check and a cost and traffic snapshot. Use when the user says "deploy to Cloud Run", "ship to staging/production", "did the deploy work", "roll back", "why is the service down/slow/erroring", "what is Cloud Run costing", "budget alert", "check traffic and logs", or "stale revision / tag still warm". Not for creating projects or writing Terraform from scratch.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Roll back: if step 4 fails: route 100% to the step-2 revisions (deploy.md), then run verify_deploy.py again.

    line 51
  2. Very specific:

    Read-only commands (describe, list, logging read, monitoring queries, both scripts) do not.

    line 64
  3. Distinctive:

    If users are being hurt right now, rolling back to the recorded revision is allowed.

    line 65
  4. Distinctive:

    Never print secrets: Read a secret only into a variable inside a subshell.

    line 70
  5. Very specific:

    Settings belong to their source: If scaling, CPU, memory, env vars or secrets are declared in Terraform or another tool, change them there, …

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cloud Run operations

For teams that run one or more Cloud Run services per environment (for example staging and production) and deploy them from a container image. It covers the release loop and the questions that follow it: is it healthy, what is it costing, what is calling it. It does not create projects, networks or IAM, and it does not replace infrastructure-as-code: settings that live in Terraform stay in Terraform.

Two read-only scripts ship with the skill (Python 3 standard library plus an authenticated gcloud):

# After a deploy: Ready, latest created revision is ready, it serves 100%, no tags, no ERROR logs.
python3 -I <this skill's folder>/scripts/verify_deploy.py --project PROJECT --region REGION \
  --services SERVICE_A,SERVICE_B [--health-url https://HOST/health] [--minutes 15]
# Cost and traffic: scaling, instances per revision, requests by class, instance-hours,
# fixed-cost resources, Cloud Scheduler jobs, top 4xx/5xx paths, then WARN findings.
python3 -I <this skill's folder>/scripts/cloudrun_snapshot.py --project PROJECT --region REGION \
  [--days 7] [--service-prefix PREFIX]

verify_deploy.py exits 0 only if every check passes (1 = a check failed, 2 = could not read).

Steps

  1. Establish the target. Find the project, region, service names, health URL and which environment is production: the repo's deploy scripts, Terraform (google_cloud_run_v2_service), docs, or gcloud run services list --project P --region R. If the repo has a .cloud-run-ops.json (format in references/profile.md), use it. Tell the user what you found and ask for anything missing. Never guess the production project.
  2. Read the current state with verify_deploy.py for the environment. Write down, per service, the revision at percent: 100: this is the rollback target. Ignore 0% entries.
  3. Deploy following references/deploy.md: the repo's own deploy script if it has one, otherwise the generic sequence (build linux/amd64, push, deploy by digest with --no-traffic, then update-traffic --to-latest --clear-tags). Lower environments first. Database migrations, if any, run before the deploy and must be backward compatible.
  4. Verify with verify_deploy.py; it must exit 0. Then make one real request through the public entry point (app, load balancer or domain).
  5. Roll back if step 4 fails: route 100% to the step-2 revisions (deploy.md), then run verify_deploy.py again.
  6. Diagnose cost, traffic or errors with cloudrun_snapshot.py first, then references/diagnose.md (SKU map, log recipes, metrics) and references/troubleshooting.md. Explain each WARN in plain words.
  7. Verification and report. Quote the verify_deploy.py result (or the snapshot numbers), name the environment, revisions and image digest, and list anything you could not check. Label estimates as estimates.

Rules

  • Production changes need the user's explicit yes in this conversation: deploy, any update-traffic, rollback, migration, secret version change, services update, Terraform apply. Read-only commands (describe, list, logging read, monitoring queries, both scripts) do not. If users are being hurt right now, rolling back to the recorded revision is allowed; say so at once.
  • Lower environment first. A change reaches staging and passes step 4 before production.
  • Images by digest (IMAGE@sha256:...), never a mutable tag, so a revision is reproducible.
  • No tag left behind. A tagged revision is still addressable, so it keeps its own minimum instances warm and billed even at 0% traffic. Clear tags when shifting traffic.
  • Never print secrets. Read a secret only into a variable inside a subshell; never echo it, pass it on a logged command line, or write it to a file, PR or chat.
  • Settings belong to their source. If scaling, CPU, memory, env vars or secrets are declared in Terraform or another tool, change them there, not with gcloud run services update.
  • Stop on surprises. A failing gate, an unexpected revision, or "permission denied" is reported, not routed around.
  • This skill never deletes services, revisions, images or secrets.

Related skills (optional)

NeedSkillIf missing
Alert policies (5xx, latency, saturation, billable instance time) as Terraformcloud-run-alert-configuration from google/skillsUse the metric list in diagnose.md and the Cloud Monitoring docs
A log query the recipes do not covercloud-logging-query-generation from google/skillsCloud Logging query language docs
Permission deniediam-helper-for-troubleshooting from google/skillsThe error names the missing permission; ask the project admin

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.