mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
Merge pull request #529 from docker/api
Revisit compose API so it uses compose-go Project as parameter
This commit is contained in:
commit
f80e90caca
@ -27,7 +27,6 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance"
|
"github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance"
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/compose-spec/compose-go/cli"
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -386,11 +385,7 @@ type aciComposeService struct {
|
|||||||
ctx store.AciContext
|
ctx store.AciContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *aciComposeService) Up(ctx context.Context, opts *cli.ProjectOptions) error {
|
func (cs *aciComposeService) Up(ctx context.Context, project *types.Project) error {
|
||||||
project, err := cli.ProjectFromOptions(opts)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
logrus.Debugf("Up on project with name %q\n", project.Name)
|
logrus.Debugf("Up on project with name %q\n", project.Name)
|
||||||
groupDefinition, err := convert.ToContainerGroup(ctx, cs.ctx, *project)
|
groupDefinition, err := convert.ToContainerGroup(ctx, cs.ctx, *project)
|
||||||
addTag(&groupDefinition, composeContainerTag)
|
addTag(&groupDefinition, composeContainerTag)
|
||||||
@ -401,21 +396,10 @@ func (cs *aciComposeService) Up(ctx context.Context, opts *cli.ProjectOptions) e
|
|||||||
return createOrUpdateACIContainers(ctx, cs.ctx, groupDefinition)
|
return createOrUpdateACIContainers(ctx, cs.ctx, groupDefinition)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *aciComposeService) Down(ctx context.Context, opts *cli.ProjectOptions) error {
|
func (cs *aciComposeService) Down(ctx context.Context, project string) error {
|
||||||
var project types.Project
|
logrus.Debugf("Down on project with name %q\n", project)
|
||||||
|
|
||||||
if opts.Name != "" {
|
cg, err := deleteACIContainerGroup(ctx, cs.ctx, project)
|
||||||
project = types.Project{Name: opts.Name}
|
|
||||||
} else {
|
|
||||||
fullProject, err := cli.ProjectFromOptions(opts)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
project = *fullProject
|
|
||||||
}
|
|
||||||
logrus.Debugf("Down on project with name %q\n", project.Name)
|
|
||||||
|
|
||||||
cg, err := deleteACIContainerGroup(ctx, cs.ctx, project.Name)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -426,15 +410,15 @@ func (cs *aciComposeService) Down(ctx context.Context, opts *cli.ProjectOptions)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *aciComposeService) Ps(ctx context.Context, opts *cli.ProjectOptions) ([]compose.ServiceStatus, error) {
|
func (cs *aciComposeService) Ps(ctx context.Context, project string) ([]compose.ServiceStatus, error) {
|
||||||
return nil, errdefs.ErrNotImplemented
|
return nil, errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *aciComposeService) Logs(ctx context.Context, opts *cli.ProjectOptions, w io.Writer) error {
|
func (cs *aciComposeService) Logs(ctx context.Context, project string, w io.Writer) error {
|
||||||
return errdefs.ErrNotImplemented
|
return errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *aciComposeService) Convert(ctx context.Context, opts *cli.ProjectOptions) ([]byte, error) {
|
func (cs *aciComposeService) Convert(ctx context.Context, project *types.Project) ([]byte, error) {
|
||||||
return nil, errdefs.ErrNotImplemented
|
return nil, errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,23 @@ type composeOptions struct {
|
|||||||
Environment []string
|
Environment []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *composeOptions) toProjectName() (string, error) {
|
||||||
|
if o.Name != "" {
|
||||||
|
return o.Name, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
options, err := o.toProjectOptions()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
project, err := cli.ProjectFromOptions(options)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return project.Name, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (o *composeOptions) toProjectOptions() (*cli.ProjectOptions, error) {
|
func (o *composeOptions) toProjectOptions() (*cli.ProjectOptions, error) {
|
||||||
return cli.NewProjectOptions(o.ConfigPaths,
|
return cli.NewProjectOptions(o.ConfigPaths,
|
||||||
cli.WithOsEnv,
|
cli.WithOsEnv,
|
||||||
|
@ -32,27 +32,35 @@ func convertCommand() *cobra.Command {
|
|||||||
Use: "convert",
|
Use: "convert",
|
||||||
Short: "Converts the compose file to a cloud format (default: cloudformation)",
|
Short: "Converts the compose file to a cloud format (default: cloudformation)",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
options, err := opts.toProjectOptions()
|
return runConvert(cmd.Context(), opts)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return runConvert(cmd.Context(), options)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
convertCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
|
convertCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
|
||||||
convertCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
|
convertCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
|
||||||
convertCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
|
convertCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
|
||||||
|
convertCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables")
|
||||||
|
|
||||||
return convertCmd
|
return convertCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runConvert(ctx context.Context, opts *cli.ProjectOptions) error {
|
func runConvert(ctx context.Context, opts composeOptions) error {
|
||||||
var json []byte
|
var json []byte
|
||||||
c, err := client.New(ctx)
|
c, err := client.New(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
json, err = c.ComposeService().Convert(ctx, opts)
|
|
||||||
|
options, err := opts.toProjectOptions()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
project, err := cli.ProjectFromOptions(options)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
json, err = c.ComposeService().Convert(ctx, project)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,10 @@ func runDown(ctx context.Context, opts composeOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
options, err := opts.toProjectOptions()
|
projectName, err := opts.toProjectName()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.ComposeService().Down(ctx, options)
|
return c.ComposeService().Down(ctx, projectName)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,9 @@ func runLogs(ctx context.Context, opts composeOptions) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
options, err := opts.toProjectOptions()
|
projectName, err := opts.toProjectName()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.ComposeService().Logs(ctx, options, os.Stdout)
|
return c.ComposeService().Logs(ctx, projectName, os.Stdout)
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,15 @@ func runPs(ctx context.Context, opts composeOptions) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
options, err := opts.toProjectOptions()
|
projectName, err := opts.toProjectName()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
serviceList, err := c.ComposeService().Ps(ctx, options)
|
serviceList, err := c.ComposeService().Ps(ctx, projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = printSection(os.Stdout, func(w io.Writer) {
|
err = printSection(os.Stdout, func(w io.Writer) {
|
||||||
for _, service := range serviceList {
|
for _, service := range serviceList {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%d/%d\t%s\n", service.ID, service.Name, service.Replicas, service.Desired, strings.Join(service.Ports, ", "))
|
fmt.Fprintf(w, "%s\t%s\t%d/%d\t%s\n", service.ID, service.Name, service.Replicas, service.Desired, strings.Join(service.Ports, ", "))
|
||||||
|
@ -19,6 +19,8 @@ package compose
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/compose-spec/compose-go/cli"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/client"
|
"github.com/docker/compose-cli/client"
|
||||||
@ -53,6 +55,11 @@ func runUp(ctx context.Context, opts composeOptions) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.ComposeService().Up(ctx, options)
|
project, err := cli.ProjectFromOptions(options)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.ComposeService().Up(ctx, project)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
"github.com/compose-spec/compose-go/types"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/compose"
|
"github.com/docker/compose-cli/compose"
|
||||||
"github.com/docker/compose-cli/errdefs"
|
"github.com/docker/compose-cli/errdefs"
|
||||||
@ -30,26 +30,26 @@ type composeService struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Up executes the equivalent to a `compose up`
|
// Up executes the equivalent to a `compose up`
|
||||||
func (c *composeService) Up(context.Context, *cli.ProjectOptions) error {
|
func (c *composeService) Up(context.Context, *types.Project) error {
|
||||||
return errdefs.ErrNotImplemented
|
return errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// Down executes the equivalent to a `compose down`
|
// Down executes the equivalent to a `compose down`
|
||||||
func (c *composeService) Down(context.Context, *cli.ProjectOptions) error {
|
func (c *composeService) Down(context.Context, string) error {
|
||||||
return errdefs.ErrNotImplemented
|
return errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logs executes the equivalent to a `compose logs`
|
// Logs executes the equivalent to a `compose logs`
|
||||||
func (c *composeService) Logs(context.Context, *cli.ProjectOptions, io.Writer) error {
|
func (c *composeService) Logs(context.Context, string, io.Writer) error {
|
||||||
return errdefs.ErrNotImplemented
|
return errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ps executes the equivalent to a `compose ps`
|
// Ps executes the equivalent to a `compose ps`
|
||||||
func (c *composeService) Ps(context.Context, *cli.ProjectOptions) ([]compose.ServiceStatus, error) {
|
func (c *composeService) Ps(context.Context, string) ([]compose.ServiceStatus, error) {
|
||||||
return nil, errdefs.ErrNotImplemented
|
return nil, errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert translate compose model into backend's native format
|
// Convert translate compose model into backend's native format
|
||||||
func (c *composeService) Convert(context.Context, *cli.ProjectOptions) ([]byte, error) {
|
func (c *composeService) Convert(context.Context, *types.Project) ([]byte, error) {
|
||||||
return nil, errdefs.ErrNotImplemented
|
return nil, errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
@ -20,21 +20,21 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
"github.com/compose-spec/compose-go/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Service manages a compose project
|
// Service manages a compose project
|
||||||
type Service interface {
|
type Service interface {
|
||||||
// Up executes the equivalent to a `compose up`
|
// Up executes the equivalent to a `compose up`
|
||||||
Up(ctx context.Context, opts *cli.ProjectOptions) error
|
Up(ctx context.Context, project *types.Project) error
|
||||||
// Down executes the equivalent to a `compose down`
|
// Down executes the equivalent to a `compose down`
|
||||||
Down(ctx context.Context, opts *cli.ProjectOptions) error
|
Down(ctx context.Context, projectName string) error
|
||||||
// Logs executes the equivalent to a `compose logs`
|
// Logs executes the equivalent to a `compose logs`
|
||||||
Logs(ctx context.Context, opts *cli.ProjectOptions, w io.Writer) error
|
Logs(ctx context.Context, projectName string, w io.Writer) error
|
||||||
// Ps executes the equivalent to a `compose ps`
|
// Ps executes the equivalent to a `compose ps`
|
||||||
Ps(ctx context.Context, opts *cli.ProjectOptions) ([]ServiceStatus, error)
|
Ps(ctx context.Context, projectName string) ([]ServiceStatus, error)
|
||||||
// Convert translate compose model into backend's native format
|
// Convert translate compose model into backend's native format
|
||||||
Convert(ctx context.Context, opts *cli.ProjectOptions) ([]byte, error)
|
Convert(ctx context.Context, project *types.Project) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PortPublisher hold status about published port
|
// PortPublisher hold status about published port
|
||||||
|
@ -23,8 +23,6 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
|
||||||
|
|
||||||
"github.com/docker/compose-cli/compose"
|
"github.com/docker/compose-cli/compose"
|
||||||
|
|
||||||
ecsapi "github.com/aws/aws-sdk-go/service/ecs"
|
ecsapi "github.com/aws/aws-sdk-go/service/ecs"
|
||||||
@ -53,11 +51,7 @@ const (
|
|||||||
parameterLoadBalancerARN = "ParameterLoadBalancerARN"
|
parameterLoadBalancerARN = "ParameterLoadBalancerARN"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *ecsAPIService) Convert(ctx context.Context, opts *cli.ProjectOptions) ([]byte, error) {
|
func (b *ecsAPIService) Convert(ctx context.Context, project *types.Project) ([]byte, error) {
|
||||||
project, err := cli.ProjectFromOptions(opts)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
template, err := b.convert(project)
|
template, err := b.convert(project)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
25
ecs/down.go
25
ecs/down.go
@ -18,31 +18,12 @@ package ecs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *ecsAPIService) Down(ctx context.Context, options *cli.ProjectOptions) error {
|
func (b *ecsAPIService) Down(ctx context.Context, project string) error {
|
||||||
name, err := b.projectName(options)
|
err := b.SDK.DeleteStack(ctx, project)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
return b.WaitStackCompletion(ctx, project, stackDelete)
|
||||||
err = b.SDK.DeleteStack(ctx, name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return b.WaitStackCompletion(ctx, name, stackDelete)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *ecsAPIService) projectName(options *cli.ProjectOptions) (string, error) {
|
|
||||||
name := options.Name
|
|
||||||
if name == "" {
|
|
||||||
project, err := cli.ProjectFromOptions(options)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
name = project.Name
|
|
||||||
}
|
|
||||||
return name, nil
|
|
||||||
}
|
}
|
||||||
|
12
ecs/list.go
12
ecs/list.go
@ -22,22 +22,16 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/compose"
|
"github.com/docker/compose-cli/compose"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *ecsAPIService) Ps(ctx context.Context, options *cli.ProjectOptions) ([]compose.ServiceStatus, error) {
|
func (b *ecsAPIService) Ps(ctx context.Context, project string) ([]compose.ServiceStatus, error) {
|
||||||
projectName, err := b.projectName(options)
|
parameters, err := b.SDK.ListStackParameters(ctx, project)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
parameters, err := b.SDK.ListStackParameters(ctx, projectName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cluster := parameters[parameterClusterName]
|
cluster := parameters[parameterClusterName]
|
||||||
|
|
||||||
resources, err := b.SDK.ListStackResources(ctx, projectName)
|
resources, err := b.SDK.ListStackResources(ctx, project)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
17
ecs/logs.go
17
ecs/logs.go
@ -23,26 +23,15 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *ecsAPIService) Logs(ctx context.Context, options *cli.ProjectOptions, writer io.Writer) error {
|
func (b *ecsAPIService) Logs(ctx context.Context, project string, w io.Writer) error {
|
||||||
name := options.Name
|
|
||||||
if name == "" {
|
|
||||||
project, err := cli.ProjectFromOptions(options)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
name = project.Name
|
|
||||||
}
|
|
||||||
|
|
||||||
consumer := logConsumer{
|
consumer := logConsumer{
|
||||||
colors: map[string]colorFunc{},
|
colors: map[string]colorFunc{},
|
||||||
width: 0,
|
width: 0,
|
||||||
writer: writer,
|
writer: w,
|
||||||
}
|
}
|
||||||
err := b.SDK.GetLogs(ctx, name, consumer.Log)
|
err := b.SDK.GetLogs(ctx, project, consumer.Log)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
ecs/up.go
12
ecs/up.go
@ -23,17 +23,11 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *ecsAPIService) Up(ctx context.Context, options *cli.ProjectOptions) error {
|
func (b *ecsAPIService) Up(ctx context.Context, project *types.Project) error {
|
||||||
project, err := cli.ProjectFromOptions(options)
|
err := b.SDK.CheckRequirements(ctx, b.Region)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = b.SDK.CheckRequirements(ctx, b.Region)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -101,7 +95,7 @@ func (b *ecsAPIService) Up(ctx context.Context, options *cli.ProjectOptions) err
|
|||||||
go func() {
|
go func() {
|
||||||
<-signalChan
|
<-signalChan
|
||||||
fmt.Println("user interrupted deployment. Deleting stack...")
|
fmt.Println("user interrupted deployment. Deleting stack...")
|
||||||
b.Down(ctx, options) // nolint:errcheck
|
b.Down(ctx, project.Name) // nolint:errcheck
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = b.WaitStackCompletion(ctx, project.Name, operation)
|
err = b.WaitStackCompletion(ctx, project.Name, operation)
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
"github.com/compose-spec/compose-go/types"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/backend"
|
"github.com/docker/compose-cli/backend"
|
||||||
"github.com/docker/compose-cli/compose"
|
"github.com/docker/compose-cli/compose"
|
||||||
@ -122,32 +122,24 @@ func (cs *containerService) Delete(ctx context.Context, id string, request conta
|
|||||||
|
|
||||||
type composeService struct{}
|
type composeService struct{}
|
||||||
|
|
||||||
func (cs *composeService) Up(ctx context.Context, opts *cli.ProjectOptions) error {
|
func (cs *composeService) Up(ctx context.Context, project *types.Project) error {
|
||||||
prj, err := cli.ProjectFromOptions(opts)
|
fmt.Printf("Up command on project %q", project.Name)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
fmt.Printf("Up command on project %q", prj.Name)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *composeService) Down(ctx context.Context, opts *cli.ProjectOptions) error {
|
func (cs *composeService) Down(ctx context.Context, project string) error {
|
||||||
prj, err := cli.ProjectFromOptions(opts)
|
fmt.Printf("Down command on project %q", project)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
fmt.Printf("Down command on project %q", prj.Name)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *composeService) Ps(ctx context.Context, opts *cli.ProjectOptions) ([]compose.ServiceStatus, error) {
|
func (cs *composeService) Ps(ctx context.Context, project string) ([]compose.ServiceStatus, error) {
|
||||||
return nil, errdefs.ErrNotImplemented
|
return nil, errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *composeService) Logs(ctx context.Context, opts *cli.ProjectOptions, w io.Writer) error {
|
func (cs *composeService) Logs(ctx context.Context, project string, w io.Writer) error {
|
||||||
return errdefs.ErrNotImplemented
|
return errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *composeService) Convert(ctx context.Context, opts *cli.ProjectOptions) ([]byte, error) {
|
func (cs *composeService) Convert(ctx context.Context, project *types.Project) ([]byte, error) {
|
||||||
return nil, errdefs.ErrNotImplemented
|
return nil, errdefs.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user