refactor: format compose deployment plan with style, display target context

This commit is contained in:
Pasha Sviderski
2026-03-18 21:26:22 +10:00
parent 68661e57c3
commit 0f4c211002
8 changed files with 399 additions and 61 deletions
-26
View File
@@ -31,32 +31,6 @@ type Deployment struct {
plan *Plan
}
// Plan holds the compose-level deployment plan with typed volume and service operations.
type Plan struct {
Volumes []*operation.CreateVolumeOperation
Services []*deploy.ServicePlan
}
// IsEmpty returns true if the plan has no volume or service operations.
func (p *Plan) IsEmpty() bool {
return len(p.Volumes) == 0 && len(p.Services) == 0
}
// Execute runs all volume operations followed by all service operations.
func (p *Plan) Execute(ctx context.Context, cli operation.Client) error {
for _, op := range p.Volumes {
if err := op.Execute(ctx, cli); err != nil {
return err
}
}
for _, sp := range p.Services {
if err := sp.Execute(ctx, cli); err != nil {
return err
}
}
return nil
}
func NewDeployment(ctx context.Context, cli Client, project *types.Project) (*Deployment, error) {
return NewDeploymentWithStrategy(ctx, cli, project, nil)
}