Add Google Cloud Run worker sample - #219
Draft
seanbollin wants to merge 1 commit into
Draft
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 <[email protected]>
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
Adds a Cloud Run Worker sample (
src/CloudRunWorker) showing how to run a long-lived Temporal Worker on Google Cloud Run and derive its identity and Worker Deployment Version from Cloud Run metadata using the newTemporalio.Extensions.Gcp.CloudRunhelper.The sample:
TemporalClientConnectOptions.ApplyGoogleCloudRunDefaultsAsync()to read the instance id from the Cloud Run metadata server and the deployment name/revision from the environment, and set the clientIdentityto{instanceId}@{revision}.TemporalWorkerOptions.ApplyGoogleCloudRunDefaults(metadata)to enable Worker Versioning with aPinneddefault behavior, using deployment name = Cloud Run worker pool / service name and build id = Cloud Run revision.TEMPORAL_ADDRESS/TEMPORAL_NAMESPACE/TEMPORAL_TASK_QUEUEfrom the environment (plaintext connection), registers a greeting workflow + activity, and polls until the container receivesSIGTERM.It mirrors the existing
LambdaWorkersample's structure and README style, and itsREADME.mdexplains Cloud Run worker pools and how to deploy withgcloud run worker-pools deploy ... --set-env-vars ....Draft: depends on the unreleased helper
Temporalio.Extensions.Gcp.CloudRunis not published to NuGet yet (it is added by the open draft PR ontemporalio/sdk-dotnetbranchcloud-run-worker-id). So the sample temporarily references the SDK from a sibling checkout viaProjectReferenceand removes the defaultTemporalio*package references thatDirectory.Build.propsadds:When the package is released, the temporary item groups in
TemporalioSamples.CloudRunWorker.csprojshould be deleted and replaced with a single<PackageReference Include="Temporalio.Extensions.Gcp.CloudRun" />, and the project can then be added toTemporalioSamples.sln. Both the sample README and the csproj document this. This is why the PR is a draft — CI cannot build the sample from a released package until then.Because of that, the project is intentionally not added to
TemporalioSamples.slnyet, so the repo'sdotnet build(solution) stays green.Testing
Built locally against the sibling
sdk-dotnet-2checkout (dotnet build src/CloudRunWorker): succeeds, 0 warnings / 0 errors, targetingnet8.0.🤖 Generated with Claude Code