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

manage watch applied to mulitple services #12469

Merged
merged 2 commits into from
Jan 22, 2025
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
4 changes: 1 addition & 3 deletions internal/sync/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ package sync

import (
"context"

"github.com/compose-spec/compose-go/v2/types"
)

// PathMapping contains the Compose service and modified host system path.
Expand All @@ -38,5 +36,5 @@ type PathMapping struct {
}

type Syncer interface {
Sync(ctx context.Context, service types.ServiceConfig, paths []PathMapping) error
Sync(ctx context.Context, service string, paths []*PathMapping) error
}
7 changes: 3 additions & 4 deletions internal/sync/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (

"github.com/hashicorp/go-multierror"

"github.com/compose-spec/compose-go/v2/types"
moby "github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/archive"
)
Expand Down Expand Up @@ -65,8 +64,8 @@ func NewTar(projectName string, client LowLevelClient) *Tar {
}
}

func (t *Tar) Sync(ctx context.Context, service types.ServiceConfig, paths []PathMapping) error {
containers, err := t.client.ContainersForService(ctx, t.projectName, service.Name)
func (t *Tar) Sync(ctx context.Context, service string, paths []*PathMapping) error {
containers, err := t.client.ContainersForService(ctx, t.projectName, service)
if err != nil {
return err
}
Expand All @@ -77,7 +76,7 @@ func (t *Tar) Sync(ctx context.Context, service types.ServiceConfig, paths []Pat
if _, err := os.Stat(p.HostPath); err != nil && errors.Is(err, fs.ErrNotExist) {
pathsToDelete = append(pathsToDelete, p.ContainerPath)
} else {
pathsToCopy = append(pathsToCopy, p)
pathsToCopy = append(pathsToCopy, *p)
}
}

Expand Down
Loading
Loading