Skip to content

Add Cloud Run Id worker sample - #795

Draft
seanbollin wants to merge 6 commits into
mainfrom
cloud-run-worker-id
Draft

seanbollin wants to merge 6 commits into
mainfrom
cloud-run-worker-id

Conversation

@seanbollin

@seanbollin seanbollin commented Aug 25, 2026

Copy link
Copy Markdown

Runs a Temporal Worker on a Google Cloud Run worker pool using the Cloud Run Id plugin (io.temporal:temporal-gcp-cloud-run-id), which sets the Temporal client identity from Cloud Run instance metadata ({instanceId}@{revision}) so each instance is identifiable in Temporal.

Build locally: ./gradlew -PtemporalSdkPath=/path/to/sdk-java :gcp:cloud-run:id:build. Deploy: gcloud run worker-pools deploy cloud-run-id --image "$REGION-docker.pkg.dev/$PROJECT_ID/<repo>/cloud-run-id:latest" --region "$REGION".

The temporal-gcp-cloud-run-id module is unreleased, so the sample builds against a local SDK checkout via composite build (default ../sdk-java); CI stays red until it ships.

@seanbollin seanbollin changed the title Add Cloud Run worker sample (worker identity + deployment versioning) Add Google Cloud Run worker-identity sample Sep 9, 2026
seanbollin and others added 5 commits September 18, 2026 10:32
…oning

Add a runnable Temporal Java worker sample for a Google Cloud Run worker
pool. It uses io.temporal:temporal-gcp-cloud-run's GoogleCloudRunMetadata
to derive the worker identity and a PINNED Worker Deployment Version from
Cloud Run instance metadata, reads TEMPORAL_ADDRESS / TEMPORAL_NAMESPACE /
TEMPORAL_TASK_QUEUE (plaintext connection), registers a small greeting
workflow and activity, and runs until SIGTERM. Mirrors the lambda-worker
sample's layout and README style, with a Dockerfile and gcloud
worker-pools deploy instructions.

temporal-gcp-cloud-run is not yet released, so settings.gradle wires the
sample against a local SDK checkout with a Gradle composite build,
defaulting to ../sdk-java-2 and overridable with -PtemporalSdkPath. This
is temporary until the module is released; the PR stays a draft until
then.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Register CloudRunPlugin on the workflow client instead of calling the
removed GoogleCloudRunMetadata.applyTo(...) overloads. The metadata is
still fetched once at startup (so the sample can log the identity,
deployment name, and build id) and handed to the plugin, which sets the
client identity and each worker's PINNED deployment version as it
propagates from the client to its workers. The worker no longer needs
per-worker WorkerOptions. README updated to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The temporal-gcp-cloud-run module renamed CloudRunPlugin to WorkerIdPlugin
(Cloud Run can host multiple plugins in that module), so update the sample
worker and its README to construct WorkerIdPlugin. Import ordering is adjusted
to keep google-java-format's spotlessCheck clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror the sibling OpenTelemetry sample's gcp/cloud-run/opentelemetry layout:
move cloud-run-worker-id/ to gcp/cloud-run/workerid/, rename the Java package
io.temporal.samples.cloudrunworkerid to io.temporal.samples.gcp.cloudrun.workerid,
and register the module as gcp:cloud-run:workerid in settings.gradle.

The worker-identity plugin is now identity-only. Depend on the split-out
temporal-gcp-cloud-run-worker-id module (package io.temporal.gcp.cloudrun.workerid),
register WorkerIdPlugin, log only the derived identity and task queue, and drop the
stale worker-deployment-versioning references from the sample sources and README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@seanbollin seanbollin changed the title Add Google Cloud Run worker-identity sample Add Cloud Run worker-identity sample Sep 18, 2026
@seanbollin seanbollin changed the title Add Cloud Run worker-identity sample Add Cloud Run Id sample Sep 18, 2026
@seanbollin seanbollin changed the title Add Cloud Run Id sample Add Cloud Run Id worker sample Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant