Skip to content

Add support for Worker Deployment Versions (Go worker)#338

Merged
veeral-patel merged 4 commits intomainfrom
add-worker-deployment-versions
Apr 24, 2026
Merged

Add support for Worker Deployment Versions (Go worker)#338
veeral-patel merged 4 commits intomainfrom
add-worker-deployment-versions

Conversation

@veeral-patel
Copy link
Copy Markdown
Contributor

@veeral-patel veeral-patel commented Apr 24, 2026

Summary

This PR adds --deployment-name, --deployment-build-id, and --default-versioning-behavior flags to the Omes worker CLI.

Context

Omes currently only supports the legacy Build ID based worker versioning scheme for the Go worker. This PR adds flags for Deployment Versions, and initializes the worker accordingly.

We continue to support the legacy Build ID based path, but I've added a comment stating that those flags are deprecated. We can phase out this path entirely in the near future.

Out of scope: Python / TypeScript / Java / .NET worker wiring

Files changed

File Change
cmd/clioptions/worker.go Added DeploymentName, DeploymentBuildID, DefaultVersioningBehavior fields on WorkerOptions and registered --deployment-name, --deployment-build-id, --default-versioning-behavior flags. Clarified --build-id description as legacy and mutually exclusive with --deployment-name.
workers/go/worker/worker.go Hoisted worker.Options construction out of the per-task-queue goroutine. When --deployment-name is set, builds worker.DeploymentOptions from DeploymentName + DeploymentBuildID + resolved DefaultVersioningBehavior; otherwise keeps the legacy BuildID + UseBuildIDForVersioning path (now commented as deprecated). Added parseVersioningBehavior helper (accepts pinned, auto-upgrade; defaults to auto-upgrade on empty). Added up-front validation for the three mutually-exclusive / required-together flag combinations.

Test plan

  • go build ./... passes
  • Baseline scenario (no versioning flags) completes 3 iterations in ~2s with embedded server
  • Deployment-versioned worker starts cleanly and logs "Started Worker" ... "BuildID": "v1" under --deployment-name omes-test --deployment-build-id v1 --default-versioning-behavior auto-upgrade
  • --build-id + --deployment-name → fatal --build-id and --deployment-name are mutually exclusive; use --deployment-build-id with --deployment-name
  • --deployment-name without --deployment-build-id → fatal --deployment-build-id is required when --deployment-name is set
  • --deployment-build-id without --deployment-name → fatal --deployment-build-id requires --deployment-name
  • --default-versioning-behavior bogus → fatal invalid --default-versioning-behavior "bogus" (expected pinned or auto-upgrade)
  • Legacy --build-id path compiles and reaches the deprecated code branch (runtime end-to-end depends on task-queue Build-ID assignment rules, unchanged from prior behavior)

Adds --deployment-name and --default-versioning-behavior flags that
wire the Go worker into Temporal's Worker Deployment Versioning via
worker.DeploymentOptions. When --deployment-name is set, the worker
registers as a versioned member of the deployment; otherwise the
legacy --build-id path is preserved unchanged.
@veeral-patel veeral-patel requested review from a team as code owners April 24, 2026 19:28
Comment thread workers/go/worker/worker.go
@veeral-patel veeral-patel requested a review from THardy98 April 24, 2026 19:44
Makes the legacy and deployment paths independent: --build-id is the
legacy Build-ID-based versioning input, and --deployment-build-id is
the build identifier within a Worker Deployment. The two are mutually
exclusive, and --deployment-build-id is required whenever
--deployment-name is set.
Notes at the BuildID + UseBuildIDForVersioning call site that the
Build-ID-based versioning API is deprecated and that new users should
use --deployment-name + --deployment-build-id instead.
workerOpts := worker.Options{
MaxConcurrentActivityExecutionSize: options.MaxConcurrentActivities,
MaxConcurrentWorkflowTaskExecutionSize: options.MaxConcurrentWorkflowTasks,
ActivityTaskPollerBehavior: makePollerBehavior(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lack of aligned indents makes this harder to read imo (usually IDEs do the indent alignment, and AI-generated code does not, maybe it's "go fmt" not sure?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlydf I checked the files I modified in this PR with go fmt and they all passed the go fmt check!

Comment thread workers/go/worker/worker.go
Copy link
Copy Markdown
Contributor

@THardy98 THardy98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, couple nits worth addressing

Comment thread cmd/clioptions/worker.go Outdated
}
m.fs = pflag.NewFlagSet("worker_options", pflag.ExitOnError)
m.fs.StringVar(&m.BuildID, "build-id", "", "Build ID")
m.fs.StringVar(&m.BuildID, "build-id", "", "Build ID for legacy Build-ID-based worker versioning. Mutually exclusive with --deployment-name")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth explicitly marking this as deprecated (especially given that deployment-build-id exists)

Copy link
Copy Markdown
Contributor Author

@veeral-patel veeral-patel Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I've updated the CLI arg description for build-id to mention it's deprecated.

Comment thread cmd/clioptions/worker.go
m.fs.StringVar(&m.BuildID, "build-id", "", "Build ID for legacy Build-ID-based worker versioning. Mutually exclusive with --deployment-name")
m.fs.StringVar(&m.DeploymentName, "deployment-name", "", "Worker Deployment name. When set, enables Worker Deployment Versioning and must be combined with --deployment-build-id")
m.fs.StringVar(&m.DeploymentBuildID, "deployment-build-id", "", "Build ID within the Worker Deployment. Required when --deployment-name is set")
m.fs.StringVar(&m.DefaultVersioningBehavior, "default-versioning-behavior", "", "Default versioning behavior for workflows that don't set one at registration. One of: pinned, auto-upgrade. Defaults to auto-upgrade when --deployment-name is set")
Copy link
Copy Markdown
Contributor

@THardy98 THardy98 Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want a default value here? (not sure if this is desirable, just a thought. Deferring to yall, feel free to ignore)

Copy link
Copy Markdown
Contributor Author

@veeral-patel veeral-patel Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@THardy98 No, I don't think there's a reasonable default we could set for the deployment name and build ID! But thank you for flagging!

veeral-patel added a commit to veeral-patel/keda that referenced this pull request Apr 24, 2026
… worker

Switch the deployment-version subtest from a locally-built
temporal-deployment-worker image to a pinned tag of
temporaliotest/omes that was built from the PR adding deployment
versioning support to omes (temporalio/omes#338):

  docker.io/temporaliotest/omes:go-89ab7fe@sha256:791a2eecd942f78a207ce600a1c1c5d5800eb34167f6ec98c0722e91ea7d6771

This removes the need for a custom worker binary maintained in the
KEDA tree, aligning the deployment-version test with the existing
unversioned and build-id tests that already use omes. The image is
public on Docker Hub so KEDA's CI cluster can pull it without any
extra infrastructure.

Also removes the now-unused tests/scalers/temporal/worker/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Veeral Patel <veeral.patel@temporal.io>
@veeral-patel veeral-patel merged commit 1747d53 into main Apr 24, 2026
34 checks passed
@veeral-patel veeral-patel deleted the add-worker-deployment-versions branch April 24, 2026 21:50
veeral-patel added a commit to veeral-patel/keda that referenced this pull request Apr 29, 2026
… worker

Switch the deployment-version subtest from a locally-built
temporal-deployment-worker image to a pinned tag of
temporaliotest/omes that was built from the PR adding deployment
versioning support to omes (temporalio/omes#338):

  docker.io/temporaliotest/omes:go-89ab7fe@sha256:791a2eecd942f78a207ce600a1c1c5d5800eb34167f6ec98c0722e91ea7d6771

This removes the need for a custom worker binary maintained in the
KEDA tree, aligning the deployment-version test with the existing
unversioned and build-id tests that already use omes. The image is
public on Docker Hub so KEDA's CI cluster can pull it without any
extra infrastructure.

Also removes the now-unused tests/scalers/temporal/worker/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Veeral Patel <veeral.patel@temporal.io>
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.

3 participants