Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/temporalcli/commands.worker.deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type priorityStatsDisplayRow struct {
type formattedWorkerDeploymentVersionInfoType struct {
DeploymentName string `json:"deploymentName"`
BuildID string `json:"BuildID"`
Status string `json:"status"`
CreateTime time.Time `json:"createTime"`
RoutingChangedTime time.Time `json:"routingChangedTime"`
CurrentSinceTime time.Time `json:"currentSinceTime"`
Expand Down Expand Up @@ -308,6 +309,10 @@ func drainageStatusProtoToStr(status enumspb.VersionDrainageStatus) (string, err
}
}

func versionStatusProtoToStr(status enumspb.WorkerDeploymentVersionStatus) string {
return strings.ToLower(strings.TrimPrefix(status.String(), "WORKER_DEPLOYMENT_VERSION_STATUS_"))
}

func taskQueueTypeProtoToStr(taskQueueType enumspb.TaskQueueType) (string, error) {
switch taskQueueType {
case enumspb.TASK_QUEUE_TYPE_UNSPECIFIED:
Expand Down Expand Up @@ -528,6 +533,7 @@ func workerDeploymentVersionInfoProtoToRows(deploymentInfo *deploymentpb.WorkerD
return formattedWorkerDeploymentVersionInfoType{
DeploymentName: deploymentInfo.GetDeploymentVersion().GetDeploymentName(),
BuildID: deploymentInfo.GetDeploymentVersion().GetBuildId(),
Status: versionStatusProtoToStr(deploymentInfo.GetStatus()),
CreateTime: deploymentInfo.GetCreateTime().AsTime(),
RoutingChangedTime: deploymentInfo.GetRoutingChangedTime().AsTime(),
CurrentSinceTime: deploymentInfo.GetCurrentSinceTime().AsTime(),
Expand Down Expand Up @@ -606,6 +612,7 @@ func printWorkerDeploymentVersionInfoProto(cctx *CommandContext, deploymentInfo
printMe := struct {
DeploymentName string
BuildID string
Status string
CreateTime time.Time
RoutingChangedTime time.Time `cli:",cardOmitEmpty"`
CurrentSinceTime time.Time `cli:",cardOmitEmpty"`
Expand All @@ -619,6 +626,7 @@ func printWorkerDeploymentVersionInfoProto(cctx *CommandContext, deploymentInfo
}{
DeploymentName: deploymentInfo.GetDeploymentVersion().GetDeploymentName(),
BuildID: deploymentInfo.GetDeploymentVersion().GetBuildId(),
Status: fDeploymentInfo.Status,
CreateTime: deploymentInfo.GetCreateTime().AsTime(),
RoutingChangedTime: deploymentInfo.GetRoutingChangedTime().AsTime(),
CurrentSinceTime: deploymentInfo.GetCurrentSinceTime().AsTime(),
Expand Down
28 changes: 28 additions & 0 deletions internal/temporalcli/commands.worker.deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type jsonComputeConfig struct {

type jsonDeploymentVersionInfoType struct {
Version string `json:"version"`
Status string `json:"status"`
CreateTime time.Time `json:"createTime"`
RoutingChangedTime time.Time `json:"routingChangedTime"`
CurrentSinceTime time.Time `json:"currentSinceTime"`
Expand Down Expand Up @@ -524,6 +525,14 @@ func (s *SharedServerSuite) TestDeployment_Describe_Drainage() {
}, 30*time.Second, 100*time.Millisecond)

res := s.Execute(
"worker", "deployment", "describe-version",
"--address", s.Address(),
"--deployment-name", version1.DeploymentName, "--build-id", version1.BuildID,
)
s.NoError(res.Err)
s.ContainsOnSameLine(res.Stdout.String(), "Status", "inactive")

res = s.Execute(
"worker", "deployment", "set-current-version",
"--address", s.Address(),
"--deployment-name", version1.DeploymentName, "--build-id", version1.BuildID,
Expand Down Expand Up @@ -582,6 +591,25 @@ func (s *SharedServerSuite) TestDeployment_Describe_Drainage() {
s.Equal(version1.BuildID, jsonOut.VersionSummaries[0].BuildID)
s.Equal("unspecified", jsonOut.VersionSummaries[1].DrainageStatus)
s.Equal(version2.BuildID, jsonOut.VersionSummaries[1].BuildID)

res = s.Execute(
"worker", "deployment", "describe-version",
"--address", s.Address(),
"--deployment-name", version1.DeploymentName, "--build-id", version1.BuildID,
)
s.NoError(res.Err)
s.ContainsOnSameLine(res.Stdout.String(), "Status", "draining")

res = s.Execute(
"worker", "deployment", "describe-version",
"--address", s.Address(),
"--deployment-name", version2.DeploymentName, "--build-id", version2.BuildID,
"--output", "json",
)
s.NoError(res.Err)
var jsonVersionOut jsonDeploymentVersionInfoType
s.NoError(json.Unmarshal(res.Stdout.Bytes(), &jsonVersionOut))
s.Equal("current", jsonVersionOut.Status)
}

func (s *SharedServerSuite) TestDeployment_Ramping() {
Expand Down