Add Cloud Run Id worker sample - #795
Draft
seanbollin wants to merge 6 commits into
Draft
seanbollin wants to merge 6 commits into
seanbollin wants to merge 6 commits into
Conversation
…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
force-pushed
the
cloud-run-worker-id
branch
from
September 18, 2026 17:37
559b030 to
9dc533b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-idmodule is unreleased, so the sample builds against a local SDK checkout via composite build (default../sdk-java); CI stays red until it ships.