Commit 1747d53
authored
Add support for Worker Deployment Versions (Go worker) (#338)
## 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
- [x] `go build ./...` passes
- [x] Baseline scenario (no versioning flags) completes 3 iterations in
~2s with embedded server
- [x] 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`
- [x] `--build-id` + `--deployment-name` → fatal `--build-id and
--deployment-name are mutually exclusive; use --deployment-build-id with
--deployment-name`
- [x] `--deployment-name` without `--deployment-build-id` → fatal
`--deployment-build-id is required when --deployment-name is set`
- [x] `--deployment-build-id` without `--deployment-name` → fatal
`--deployment-build-id requires --deployment-name`
- [x] `--default-versioning-behavior bogus` → fatal `invalid
--default-versioning-behavior "bogus" (expected pinned or auto-upgrade)`
- [x] 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)1 parent 4084919 commit 1747d53
2 files changed
Lines changed: 62 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
71 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
72 | 126 | | |
73 | 127 | | |
74 | 128 | | |
| |||
84 | 138 | | |
85 | 139 | | |
86 | 140 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 141 | + | |
102 | 142 | | |
103 | 143 | | |
104 | 144 | | |
| |||
0 commit comments