Add Google Cloud Run worker-identity sample - #219
Draft
seanbollin wants to merge 6 commits into
Draft
seanbollin wants to merge 6 commits into
seanbollin wants to merge 6 commits into
Conversation
Add a long-lived Temporal Worker sample for Google Cloud Run that uses the new Temporalio.Extensions.Gcp.CloudRun helper to derive the worker identity and a pinned Worker Deployment Version from Cloud Run metadata. It reads TEMPORAL_ADDRESS / TEMPORAL_NAMESPACE / TEMPORAL_TASK_QUEUE from the environment, registers a greeting workflow and activity, and polls until the container is stopped. The helper is unreleased, so the project temporarily references the SDK from a sibling sdk-dotnet checkout via ProjectReference; the README and csproj explain how to switch to the released package. This is why the PR is a draft. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Register a single CloudRunPlugin on TemporalClientConnectOptions.Plugins instead of calling the removed ApplyGoogleCloudRunDefaults* helpers. The plugin sets the client identity at connect time and pins the worker to the Cloud Run deployment version automatically. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follows the sdk-dotnet rename: the Cloud Run worker-identity plugin is now WorkerIdPlugin (Cloud Run can host multiple Temporal plugins, so the generic CloudRunPlugin name is no longer used). Update the sample's registration, workflow comment, and README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Google Cloud Run worker-ID plugin moved from the root Temporalio.Extensions.Gcp.CloudRun project into a new Temporalio.Extensions.Gcp.CloudRun.WorkerId sibling. Update the project reference, the using directive, and the README to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move src/CloudRunWorker to src/Gcp/CloudRun/WorkerId to mirror the sibling OpenTelemetry Cloud Run sample, and rename the project and namespace to TemporalioSamples.Gcp.CloudRun.WorkerId. Register the moved project in the solution and update the root README sample entry. Remove all Worker Deployment Versioning content (deployment name, build id, versioning behavior, pinned) from the code, comments, and README. The sample now only registers WorkerIdPlugin to set the worker identity from Cloud Run metadata, and logs GoogleCloudRunMetadata.WorkerIdentity. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Runnable Google Cloud Run worker-identity sample, laid out under
src/Gcp/CloudRun/WorkerIdto match the sibling OpenTelemetry Cloud Run sample (src/Gcp/CloudRun/OpenTelemetry).It registers a single
WorkerIdPluginonTemporalClientConnectOptions.Pluginsso the worker identity ({instanceId}@{revision}) is derived from Cloud Run instance metadata and applied to the client, and to every worker created from it.Program.csalso readsGoogleCloudRunMetadatadirectly and logs itsWorkerIdentity. A greeting workflow + activity and aSIGTERM-aware worker loop demonstrate a normal long-lived worker on a Cloud Run worker pool; the workflow is started with the Temporal CLI. No Worker Deployment Versioning — identity only.Draft: depends on the unreleased helper
Temporalio.Extensions.Gcp.CloudRun.WorkerIdis not published to NuGet yet (it is added by the open draft PR ontemporalio/sdk-dotnetbranchcloud-run-worker-id). While it is unreleased the sample temporarily references the SDK from a sibling checkout viaProjectReferenceand removes the defaultTemporalio*package references thatDirectory.Build.propsadds:When the package is released, replace the temporary item groups in
TemporalioSamples.Gcp.CloudRun.WorkerId.csprojwith a single<PackageReference Include="Temporalio.Extensions.Gcp.CloudRun.WorkerId" />. This is why the PR is a draft. The README and csproj document this.Run
Deploy to a Cloud Run worker pool, then start the greeting workflow with the Temporal CLI — see
src/Gcp/CloudRun/WorkerId/README.md.Testing
dotnet build src/Gcp/CloudRun/WorkerId/TemporalioSamples.Gcp.CloudRun.WorkerId.csproj— succeeds, 0 warnings / 0 errors, targetingnet8.0.dotnet format --verify-no-changes— clean.🤖 Generated with Claude Code