Skip to content

Commit

Permalink
Display git sha in koyeb dep list and dep describe
Browse files Browse the repository at this point in the history
  • Loading branch information
brmzkw committed Feb 12, 2024
1 parent c332baa commit cf82b0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pkg/koyeb/deployments_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()).
Expand Down Expand Up @@ -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),
Expand Down
8 changes: 7 additions & 1 deletion pkg/koyeb/deployments_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit cf82b0e

Please sign in to comment.