Skip to content
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

Display git sha in koyeb dep list and dep describe #184

Merged
merged 1 commit into from
Feb 12, 2024
Merged
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
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
Loading