agentleFS
daichi-0818daichi-0818/claude-code-ops-kit/skills/cloud-run-job-deploy/SKILL.md

cloud-run-job-deploy

Skill0 starsChanged 49 days agoMITView on GitHub

Deploy procedure for Cloud Run Jobs (batch / scheduled workloads) — fires on "deploy the job", "jobs update", "ship the batch job". Assumes the generic pre-deploy gate already passed; adds the job-specific steps that prevent silent batch failures.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 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.

  • 2

    Very specific

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

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

    Run the generic pre-deploy gates first.

    line 7
  2. Distinctive:

    Write the old image sha down before touching anything.

    line 22
  3. Very specific:

    Check: expected runtime < timeoutSeconds < trigger interval (with margin).

    line 49
  4. Distinctive:

    When runtime exceeds the interval, executions overlap and failures hide behind the "latest execution".

    line 50

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 Job Deploy

Run the generic pre-deploy gates first. Then:

Principles

  • One job per deploy.
  • Build from merged main, not from a feature branch.
  • Image-only updates: pass --image and nothing else, so existing env vars and secrets survive.

Steps

1. Record the rollback target (first, always)

gcloud run jobs describe <JOB> --region=<REGION> --project=<PROJECT> \
  --format="value(spec.template.spec.template.spec.containers[0].image)"

Write the old image sha down before touching anything.

2. Build

Build from the merge commit. Confirm the build reports SUCCESS and the image tag is the sha you intended.

3. Update (image only)

gcloud run jobs update <JOB> --region=<REGION> --project=<PROJECT> \
  --image=<AR_PATH>/<IMAGE>:<SHA>

Immediately describe again: new sha in place, env-var count unchanged.

4. Verify by execution — and read the logs

gcloud run jobs execute <JOB> --region=<REGION> --project=<PROJECT> --wait

succeededCount=1 is not enough: exit 0 with an empty run is a real failure mode. Read the execution logs and find positive evidence the work actually happened ("export finished", row counts written, …).

5. Register in monitoring

Scheduler registration is not monitoring. If the job is not added to whatever watches your jobs, it can fail silently for weeks. Add it now, in the same change — not "later".

6. Timeout vs. trigger interval

Check: expected runtime < timeoutSeconds < trigger interval (with margin). When runtime exceeds the interval, executions overlap and failures hide behind the "latest execution".

Rollback

gcloud run jobs update <JOB> --region=<REGION> --project=<PROJECT> \
  --image=<the image recorded in step 1>

Afterwards

Log the deploy (job, old/new sha, verification evidence). For incident-driven changes, watch the next scheduled execution complete once.

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.