Skip to content

Commit 8e7318e

Browse files
begelundmullernishantmonu51
authored andcommitted
Show prod deployment status in rill sudo project get (#9559)
1 parent 5999828 commit 8e7318e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

cli/cmd/sudo/project/get.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func GetCmd(ch *cmdutil.Helper) *cobra.Command {
5050
fmt.Printf("Prod slots: %d\n", project.ProdSlots)
5151
fmt.Printf("Primary deployment ID: %s\n", project.PrimaryDeploymentId)
5252
fmt.Printf("Prod hibernation TTL: %s\n", time.Duration(project.ProdTtlSeconds)*time.Second)
53+
fmt.Printf("Prod deployment status: %s\n", prodDeploymentStatus(res.Deployment))
5354
fmt.Printf("Annotations: %s\n", strings.Join(annotations, "; "))
5455

5556
return nil
@@ -58,3 +59,31 @@ func GetCmd(ch *cmdutil.Helper) *cobra.Command {
5859

5960
return getCmd
6061
}
62+
63+
// prodDeploymentStatus returns a human-readable description of the prod deployment's status.
64+
// A project with no prod deployment, or one that is stopped, is hibernated.
65+
func prodDeploymentStatus(depl *adminv1.Deployment) string {
66+
if depl == nil {
67+
return "Hibernated (no deployment)"
68+
}
69+
switch depl.Status {
70+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_PENDING:
71+
return "Pending"
72+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_RUNNING:
73+
return "Running"
74+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_ERRORED:
75+
return "Errored"
76+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_STOPPED:
77+
return "Hibernated (stopped)"
78+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_UPDATING:
79+
return "Updating"
80+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_STOPPING:
81+
return "Hibernating (stopping)"
82+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_DELETING:
83+
return "Deleting"
84+
case adminv1.DeploymentStatus_DEPLOYMENT_STATUS_DELETED:
85+
return "Deleted"
86+
default:
87+
return "Unknown"
88+
}
89+
}

0 commit comments

Comments
 (0)