diff --git a/CHANGES.md b/CHANGES.md index cda25f8a..78389ead 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ * `koyeb service update`: remove autoscaling targets when --min-scale is equal to --max-scale - https://github.com/koyeb/koyeb-cli/issues/182 +* `koyeb deployment get` and `koyeb deployment describe` now display the GIT commit hash for git services types + - https://github.com/koyeb/koyeb-cli/pull/184 ## v3.7.1 diff --git a/pkg/koyeb/deployments_describe.go b/pkg/koyeb/deployments_describe.go index 9bd4a77b..16cc3634 100644 --- a/pkg/koyeb/deployments_describe.go +++ b/pkg/koyeb/deployments_describe.go @@ -25,7 +25,6 @@ func (h *DeploymentHandler) Describe(ctx *CLIContext, cmd *cobra.Command, args [ resp, ) } - // TODO(tleroux): Experimental for now. regionalRes, resp, err := ctx.Client.RegionalDeploymentsApi.ListRegionalDeployments(ctx.Context). DeploymentId(res.Deployment.GetId()). @@ -93,14 +92,21 @@ func (r *DescribeDeploymentReply) MarshalBinary() ([]byte, error) { } func (r *DescribeDeploymentReply) Headers() []string { - return []string{"id", "service", "status", "messages", "regions", "created_at", "updated_at", "definition"} + return []string{"id", "service", "git sha", "status", "messages", "regions", "created_at", "updated_at", "definition"} } func (r *DescribeDeploymentReply) Fields() []map[string]string { item := r.value.GetDeployment() + + sha := "N/A" + if item.ProvisioningInfo != nil { + sha = *item.ProvisioningInfo.Sha + } + fields := map[string]string{ "id": renderer.FormatID(item.GetId(), r.full), "service": renderer.FormatServiceSlug(r.mapper, item.GetServiceId(), r.full), + "git sha": sha, "status": formatDeploymentStatus(item.GetStatus()), "messages": formatDeploymentMessages(item.GetMessages(), 0), "regions": renderRegions(item.Definition.Regions), diff --git a/pkg/koyeb/deployments_get.go b/pkg/koyeb/deployments_get.go index 9a71e6f9..9be0fa50 100644 --- a/pkg/koyeb/deployments_get.go +++ b/pkg/koyeb/deployments_get.go @@ -55,14 +55,20 @@ func (r *GetDeploymentReply) MarshalBinary() ([]byte, error) { } func (r *GetDeploymentReply) Headers() []string { - return []string{"id", "service", "type", "status", "messages", "regions", "created_at"} + return []string{"id", "service", "git sha", "type", "status", "messages", "regions", "created_at"} } func (r *GetDeploymentReply) Fields() []map[string]string { item := r.value.GetDeployment() + sha := "N/A" + if item.ProvisioningInfo != nil { + sha = *item.ProvisioningInfo.Sha + } + fields := map[string]string{ "id": renderer.FormatID(item.GetId(), r.full), "service": renderer.FormatServiceSlug(r.mapper, item.GetServiceId(), r.full), + "git sha": sha, "type": formatDeploymentType(item.Definition.GetType()), "status": formatDeploymentStatus(item.GetStatus()), "messages": formatDeploymentMessages(item.GetMessages(), 0),