Set Traffic

cloud_run.set_traffic
ActionGoogle Cloudconnection required

Calls Cloud Run Admin API v2 PATCH /services/{s}?updateMask=traffic.

Route a Cloud Run service's traffic to a revision (rollback or canary).

Connection

Required
Yes — the node will not save without one
Auth type
OAuth 2.0
Providers
Google Cloud Run
Secret shape
{"client_id", "client_secret", "refresh_token"}
Config it needs
project_id, region
Resolved by
config.connection_id, else node.connection_id

Configuration

8 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
project_id
GCP project id (overrides connection).
stringNo———
region
Cloud Run region (overrides connection).
stringNous-central1——
service
Service name.
stringYes———
revision
Revision to send traffic to, e.g. api-00042-abc.
stringNo———
percent
Share for that revision; the remainder goes to 'fallback_revision'.
numberNo1000–100—
fallback_revision
Revision that keeps the remaining traffic when percent < 100. Left blank, the revision currently serving the most traffic is used.
stringNo———
to_latest
Send 100% to the latest revision instead of a named one.
booleanNofalse——
traffic
Raw TrafficTarget list, for allocations the fields above cannot express.
arrayNo—array of object—
  • At least one of revision, to_latest, traffic must be set.

Example configuration

Every value below is the contract’s own example or default — nothing invented.

{
  "percent": 100,
  "region": "us-central1",
  "to_latest": false
}

Output

One shape.

result

FieldTypeExample
ok
boolean—
operation
Feed this to cloud_run.wait_operation.
string—
done
boolean—
error
Set only when Cloud Run rejected the patch.
object—
traffic
The allocation that was sent.
array—
{
  "done": false,
  "error": {},
  "ok": false,
  "operation": "",
  "traffic": []
}

Notes

  • Percentages must total 100; the remainder is assigned to `fallback_revision` for you, defaulting to the revision serving the most traffic right now.
  • The remainder never goes to the latest revision: after a deploy the latest revision is the one being canaried, so that would put 100% on it.
  • A revision whose `ready` is false cannot serve — check cloud_run.list_revisions before rolling back onto one.

See Set Traffic run in a workflow.

In a technical demo we add the Google Cloud Run connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.