Skip to content

Conversation

@lionello
Copy link
Member

@lionello lionello commented Oct 7, 2025

Description

  • unify service status table from defang services and defang [compose] up
  • do HTTP(S) query for each endpoint to asses real-time state/health
  • separate CW code into cw package

Linked Issues

Checklist

  • I have performed a self-review of my code
  • I have added appropriate tests
  • I have updated the Defang CLI docs and/or README to reflect my changes, if necessary

"DEFANG_JSON": os.Getenv("DEFANG_JSON"),
"DEFANG_ORG": b.TenantName,
"DEFANG_PREFIX": byoc.DefangPrefix,
"DEFANG_PREVIEW": "true", // always preview HACK
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"DEFANG_PREVIEW": "true", // always preview HACK

cr, err := cancelreader.NewReader(os.Stdin)
if err != nil {
return os.Stdin
return os.NewFile(uintptr(syscall.Stdin), "/dev/stdin")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix for #1240

Comment on lines 540 to +583

/*if len(listServiceResp.Services) > 0 {
cfg, err := b.driver.LoadConfig(ctx)
if err != nil {
return nil, AnnotateAwsError(err)
}
ecsClient := awsecs.NewFromConfig(cfg) // Ensure the ECS client is initialized
lso, err := ecsClient.ListServices(ctx, &awsecs.ListServicesInput{
Cluster: ptr.String(b.driver.ClusterName),
MaxResults: ptr.Int32(100), // 100=maximum
})
if err != nil {
return nil, AnnotateAwsError(err)
}
var services []string
for _, service := range listServiceResp.Services {
// Find the physical service name
for _, ecsService := range lso.ServiceArns {
if strings.HasSuffix(*ecsService, service.Service.Name) {
// The physical service name is the one with the Pulumi suffix
services = append(services, service.Service.Name) //this is wrong, since the physical name has the Pulumi suffix
}
dso, err := ecsClient.DescribeServices(ctx, &awsecs.DescribeServicesInput{
Cluster: ptr.String(b.driver.ClusterName),
Services: services,
})
if err != nil {
return nil, AnnotateAwsError(err)
}
bytes, _ := json.Marshal(dso)
term.Debug(string(bytes))
for _, service := range projUpdate.Services {
for _, ecsService := range dso.Services {
if *ecsService.ServiceName != service.Service.Name {
continue
}
ecsService.Deployments[0].
service.Status = *ecsService.Status
break
}
}
}*/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/*if len(listServiceResp.Services) > 0 {
cfg, err := b.driver.LoadConfig(ctx)
if err != nil {
return nil, AnnotateAwsError(err)
}
ecsClient := awsecs.NewFromConfig(cfg) // Ensure the ECS client is initialized
lso, err := ecsClient.ListServices(ctx, &awsecs.ListServicesInput{
Cluster: ptr.String(b.driver.ClusterName),
MaxResults: ptr.Int32(100), // 100=maximum
})
if err != nil {
return nil, AnnotateAwsError(err)
}
var services []string
for _, service := range listServiceResp.Services {
// Find the physical service name
for _, ecsService := range lso.ServiceArns {
if strings.HasSuffix(*ecsService, service.Service.Name) {
// The physical service name is the one with the Pulumi suffix
services = append(services, service.Service.Name) //this is wrong, since the physical name has the Pulumi suffix
}
dso, err := ecsClient.DescribeServices(ctx, &awsecs.DescribeServicesInput{
Cluster: ptr.String(b.driver.ClusterName),
Services: services,
})
if err != nil {
return nil, AnnotateAwsError(err)
}
bytes, _ := json.Marshal(dso)
term.Debug(string(bytes))
for _, service := range projUpdate.Services {
for _, ecsService := range dso.Services {
if *ecsService.ServiceName != service.Service.Name {
continue
}
ecsService.Deployments[0].
service.Status = *ecsService.Status
break
}
}
}*/

@lionello lionello changed the title wip Unify project status info Oct 8, 2025
@lionello lionello mentioned this pull request Nov 5, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants