-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Upgrade Go SDK to 1.35.0 #8216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Go SDK to 1.35.0 #8216
Changes from all commits
c25e670
6f56c51
f2d2426
a7f853b
5d0ff4c
18af072
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Expected workflow counts for replay testing | ||
| # Generated by generate_history.sh on Tue Aug 19 18:08:43 PDT 2025 | ||
| EXPECTED_DEPLOYMENT_WORKFLOWS=12 | ||
| EXPECTED_VERSION_WORKFLOWS=14 | ||
| ACTUAL_DEPLOYMENT_WORKFLOWS=12 | ||
| ACTUAL_VERSION_WORKFLOWS=14 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package main | |
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "log" | ||
| "time" | ||
|
|
||
|
|
@@ -20,18 +21,23 @@ func main() { | |
| defer c.Close() | ||
|
|
||
| deploymentName := "foo" | ||
| build1 := "1.0" | ||
| v1 := worker.WorkerDeploymentVersion{ | ||
| DeploymentName: deploymentName, | ||
| BuildId: build1, | ||
| } | ||
| w1 := worker.New(c, "hello-world", worker.Options{ | ||
| DeploymentOptions: worker.DeploymentOptions{ | ||
| UseVersioning: true, | ||
| Version: deploymentName + ".1.0", | ||
| Version: v1, | ||
| DefaultVersioningBehavior: workflow.VersioningBehaviorPinned, | ||
| }, | ||
| }) | ||
|
|
||
| w2 := worker.New(c, "hello-world-2", worker.Options{ | ||
| DeploymentOptions: worker.DeploymentOptions{ | ||
| UseVersioning: true, | ||
| Version: deploymentName + ".1.0", | ||
| Version: v1, | ||
| DefaultVersioningBehavior: workflow.VersioningBehaviorPinned, | ||
| }, | ||
| }) | ||
|
|
@@ -65,7 +71,7 @@ func main() { | |
|
|
||
| // Update version metadata | ||
| _, err = dHandle.UpdateVersionMetadata(context.Background(), client.WorkerDeploymentUpdateVersionMetadataOptions{ | ||
| Version: deploymentName + ".1.0", | ||
| Version: v1, | ||
| MetadataUpdate: client.WorkerDeploymentMetadataUpdate{ | ||
| UpsertEntries: map[string]interface{}{ | ||
| "key": "value", | ||
|
|
@@ -78,63 +84,66 @@ func main() { | |
|
|
||
| // Set ramping version to 1.0 | ||
| _, err = dHandle.SetRampingVersion(context.Background(), client.WorkerDeploymentSetRampingVersionOptions{ | ||
| Version: deploymentName + ".1.0", | ||
| BuildID: build1, | ||
| Percentage: 1, | ||
| }) | ||
| if err != nil { | ||
| log.Fatalln("Unable to set ramping version", err) | ||
| } | ||
| verifyDeployment(dHandle, "__unversioned__", deploymentName+".1.0", client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
| verifyDeployment(dHandle, "", build1, 1, client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
|
|
||
| // Unset the ramping version | ||
| // Set the ramp percent to 0 | ||
| // TODO(carlydf): Once we allow it, test setting ramping version to nil while current version is also nil | ||
| _, err = dHandle.SetRampingVersion(context.Background(), client.WorkerDeploymentSetRampingVersionOptions{ | ||
| Version: "", | ||
| BuildID: build1, | ||
| Percentage: 0, | ||
| }) | ||
| if err != nil { | ||
| log.Fatalln("Unable to unset ramping version", err) | ||
| log.Fatalln("Unable to set ramping version to zero", err) | ||
| } | ||
| verifyDeployment(dHandle, "__unversioned__", "", client.WorkerDeploymentVersionDrainageStatusDraining) | ||
| verifyDeployment(dHandle, "", build1, 0, client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
|
|
||
| // Set current version to 1.0 | ||
| _, err = dHandle.SetCurrentVersion(context.Background(), client.WorkerDeploymentSetCurrentVersionOptions{ | ||
| Version: deploymentName + ".1.0", | ||
| BuildID: build1, | ||
| IgnoreMissingTaskQueues: true, | ||
| }) | ||
| if err != nil { | ||
| log.Fatalln("Unable to set current version", err) | ||
| } | ||
| verifyDeployment(dHandle, deploymentName+".1.0", "", client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
| verifyDeployment(dHandle, build1, "", 0, client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
|
|
||
| // Ramp the "__unversioned__" version | ||
| _, err = dHandle.SetRampingVersion(context.Background(), client.WorkerDeploymentSetRampingVersionOptions{ | ||
| Version: "__unversioned__", | ||
| BuildID: "", | ||
| Percentage: 20, | ||
| IgnoreMissingTaskQueues: true, | ||
| }) | ||
| if err != nil { | ||
| log.Fatalln("Unable to set ramping version", err) | ||
| } | ||
| verifyDeployment(dHandle, deploymentName+".1.0", "__unversioned__", client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
| verifyDeployment(dHandle, build1, "", 20, client.WorkerDeploymentVersionDrainageStatusUnspecified) | ||
|
|
||
| // Set current version to "__unversioned__" | ||
| _, err = dHandle.SetCurrentVersion(context.Background(), client.WorkerDeploymentSetCurrentVersionOptions{ | ||
| Version: "__unversioned__", | ||
| BuildID: "", | ||
| IgnoreMissingTaskQueues: true, | ||
| }) | ||
| if err != nil { | ||
| log.Fatalln("Unable to set current version", err) | ||
| } | ||
| verifyDeployment(dHandle, "__unversioned__", "", client.WorkerDeploymentVersionDrainageStatusDraining) | ||
| verifyDeployment(dHandle, "", "", 0, client.WorkerDeploymentVersionDrainageStatusDraining) | ||
|
|
||
| // Simulating a scenario when a drained version is reactivated and then re-deactivated. | ||
|
|
||
| // Waiting for the version 1.0 to become drained. | ||
| time.Sleep(8 * time.Second) | ||
| // Make sure 1.0 is drained. | ||
| verifyDeployment(dHandle, "__unversioned__", "", client.WorkerDeploymentVersionDrainageStatusDrained) | ||
| verifyDeployment(dHandle, "", "", 0, client.WorkerDeploymentVersionDrainageStatusDrained) | ||
|
|
||
| // Rollback a drained version 1.0, so that it is the current version for this deployment | ||
| _, err = dHandle.SetCurrentVersion(context.Background(), client.WorkerDeploymentSetCurrentVersionOptions{ | ||
| Version: deploymentName + ".1.0", | ||
| BuildID: build1, | ||
| IgnoreMissingTaskQueues: true, | ||
| }) | ||
| if err != nil { | ||
|
|
@@ -144,7 +153,7 @@ func main() { | |
| // Set current version to "__unversioned__" again so that version 1.0 can start draining. This replicates the | ||
| // scenario where a rolled back version is now draining. | ||
| _, err = dHandle.SetCurrentVersion(context.Background(), client.WorkerDeploymentSetCurrentVersionOptions{ | ||
| Version: "__unversioned__", | ||
| BuildID: "", | ||
| IgnoreMissingTaskQueues: true, | ||
| }) | ||
| if err != nil { | ||
|
|
@@ -154,7 +163,7 @@ func main() { | |
| // Waiting for the version 1.0 to become drained. | ||
| time.Sleep(8 * time.Second) | ||
| // Make sure 1.0 is drained. | ||
| verifyDeployment(dHandle, "__unversioned__", "", client.WorkerDeploymentVersionDrainageStatusDrained) | ||
| verifyDeployment(dHandle, "", "", 0, client.WorkerDeploymentVersionDrainageStatusDrained) | ||
|
|
||
| // Stopping both workers | ||
| w1.Stop() | ||
|
|
@@ -165,7 +174,7 @@ func main() { | |
|
|
||
| // Delete the deployment version | ||
| _, err = dHandle.DeleteVersion(context.Background(), client.WorkerDeploymentDeleteVersionOptions{ | ||
| Version: deploymentName + ".1.0", | ||
| BuildID: build1, | ||
| SkipDrainage: true, | ||
| }) | ||
| if err != nil { | ||
|
|
@@ -184,23 +193,52 @@ func main() { | |
|
|
||
| //nolint:revive | ||
| func verifyDeployment(dHandle client.WorkerDeploymentHandle, | ||
| expectedCurrentVersion string, | ||
| expectedRampingVersion string, | ||
| expectedCurrentVersionBuildId string, | ||
| expectedRampingVersionBuildId string, | ||
| expectedRampPercentage float32, | ||
| expectedDrainageStatus client.WorkerDeploymentVersionDrainageStatus, | ||
| ) { | ||
| describeResponse, err := dHandle.Describe(context.Background(), client.WorkerDeploymentDescribeOptions{}) | ||
| if err != nil { | ||
| log.Fatalln("Unable to describe deployment", err) | ||
| } | ||
| if describeResponse.Info.RoutingConfig.CurrentVersion != expectedCurrentVersion { | ||
| log.Fatalln("Current version is not ", expectedCurrentVersion) | ||
| if cv := describeResponse.Info.RoutingConfig.CurrentVersion; cv != nil { | ||
| if cv.BuildId != expectedCurrentVersionBuildId { | ||
| log.Fatalln(fmt.Sprintf("Current version build id is %s not %s", cv.BuildId, expectedCurrentVersionBuildId)) | ||
| } | ||
| } else { | ||
| if expectedCurrentVersionBuildId != "" { | ||
| log.Fatalln("Current version is empty, expected build id ", expectedCurrentVersionBuildId) | ||
| } | ||
| } | ||
|
|
||
| if rv := describeResponse.Info.RoutingConfig.RampingVersion; rv != nil { | ||
| if rv.BuildId != expectedRampingVersionBuildId { | ||
| log.Fatalln(fmt.Sprintf("Ramping version build id is %s not %s", rv.BuildId, expectedRampingVersionBuildId)) | ||
| } | ||
| } else { | ||
| if expectedRampingVersionBuildId != "" { | ||
| log.Fatalln("Ramping version is empty, expected build id ", expectedRampingVersionBuildId) | ||
| } | ||
| } | ||
|
|
||
| if rp := describeResponse.Info.RoutingConfig.RampingVersionPercentage; rp != expectedRampPercentage { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. improved error messages here only because I ran into some dumb errors and wanted better messages |
||
| log.Fatalln(fmt.Sprintf("Ramping percent is %v, expected %v", rp, expectedRampPercentage)) | ||
| } | ||
|
|
||
| if describeResponse.Info.RoutingConfig.RampingVersion != expectedRampingVersion { | ||
| log.Fatalln("Ramping version is not ", expectedRampingVersion) | ||
| if ds := describeResponse.Info.VersionSummaries[0].DrainageStatus; ds != expectedDrainageStatus { | ||
| log.Fatalln(fmt.Sprintf("Drainage status is %v, not %v", drainageStatusString(ds), drainageStatusString(expectedDrainageStatus))) | ||
| } | ||
| } | ||
|
|
||
| if describeResponse.Info.VersionSummaries[0].DrainageStatus != expectedDrainageStatus { | ||
| log.Fatalln("Drainage status is not ", expectedDrainageStatus) | ||
| func drainageStatusString(ds client.WorkerDeploymentVersionDrainageStatus) string { | ||
| switch ds { | ||
| case client.WorkerDeploymentVersionDrainageStatusDrained: | ||
| return "Drained" | ||
| case client.WorkerDeploymentVersionDrainageStatusDraining: | ||
| return "Draining" | ||
| case client.WorkerDeploymentVersionDrainageStatusUnspecified: | ||
| return "Unspecified" | ||
| } | ||
| return "Unknown" | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1.35.0 of the SDK removes the ability to "unset" / "remove" the ramping version, you can only set it to nil (which now means unversioned) with a ramp percent of 0 for the same effect as what we previously called "unset."
We don't allow the ramping version of a worker deployment to be the same as the current version, so when the current version is nil, it is not allowed to "unset" the ramping version by setting it to nil, 0%
#8172 fixes that issue (customers have requested to be able to have current version == ramping version == nil when ramp percent is 0, so that they can reset their Worker Deployment to "unversioned" settings)