Skip to content

Add Google Cloud Run worker-identity sample - #795

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

Add Google Cloud Run worker-identity sample#795
seanbollin wants to merge 5 commits into
mainfrom
cloud-run-worker-id

Conversation

@seanbollin

@seanbollin seanbollin commented Aug 25, 2026

Copy link
Copy Markdown

What

Runnable Google Cloud Run worker-identity sample, laid out under gcp/cloud-run/workerid/ to
match the sibling OpenTelemetry Cloud Run sample (gcp/cloud-run/opentelemetry/). It registers
WorkerIdPlugin from io.temporal:temporal-gcp-cloud-run-worker-id on the client so the worker
identity ({instanceId}@{revision}) is set from Cloud Run instance metadata; a small greeting
workflow/activity runs on a normal long-lived worker on a Cloud Run worker pool, started with the
Temporal CLI. No Worker Deployment Versioning — identity only.

Why draft

The sample depends on io.temporal:temporal-gcp-cloud-run-worker-id, which is not yet released.
Until it ships, settings.gradle wires the sample against a local Temporal Java SDK checkout via a
Gradle composite build (includeBuild), defaulting to a sibling ../sdk-java-2 checkout and
overridable with -PtemporalSdkPath=/path/to/sdk-java. The composite build is skipped when that
checkout is absent, so the other samples still build. Once the module is released, drop the
composite-build block from settings.gradle and bump javaSDKVersion in the samples root
build.gradle, then take this PR out of draft.

Run

./gradlew :gcp:cloud-run:workerid:test for the unit test, then
./gradlew -PtemporalSdkPath=/path/to/sdk-java :gcp:cloud-run:workerid:installDist to build the
runnable worker; see gcp/cloud-run/workerid/README.md for the Cloud Run worker-pool deploy and
temporal workflow start steps.

🤖 Generated with Claude Code

seanbollin and others added 4 commits August 25, 2026 13:55
…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 Cloud Run worker sample (worker identity + deployment versioning) Add Google Cloud Run worker-identity sample Sep 9, 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.

2 participants