Skip to content

Commit c95b804

Browse files
committed
manage watch applied to mulitple services
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 083f676 commit c95b804

File tree

11 files changed

+388
-492
lines changed

11 files changed

+388
-492
lines changed

internal/sync/shared.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ package sync
1616

1717
import (
1818
"context"
19-
20-
"github.com/compose-spec/compose-go/v2/types"
2119
)
2220

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

4038
type Syncer interface {
41-
Sync(ctx context.Context, service types.ServiceConfig, paths []PathMapping) error
39+
Sync(ctx context.Context, service string, paths []*PathMapping) error
4240
}

internal/sync/tar.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232

3333
"github.com/hashicorp/go-multierror"
3434

35-
"github.com/compose-spec/compose-go/v2/types"
3635
moby "github.com/docker/docker/api/types"
3736
"github.com/docker/docker/pkg/archive"
3837
)
@@ -65,8 +64,8 @@ func NewTar(projectName string, client LowLevelClient) *Tar {
6564
}
6665
}
6766

68-
func (t *Tar) Sync(ctx context.Context, service types.ServiceConfig, paths []PathMapping) error {
69-
containers, err := t.client.ContainersForService(ctx, t.projectName, service.Name)
67+
func (t *Tar) Sync(ctx context.Context, service string, paths []*PathMapping) error {
68+
containers, err := t.client.ContainersForService(ctx, t.projectName, service)
7069
if err != nil {
7170
return err
7271
}
@@ -77,7 +76,7 @@ func (t *Tar) Sync(ctx context.Context, service types.ServiceConfig, paths []Pat
7776
if _, err := os.Stat(p.HostPath); err != nil && errors.Is(err, fs.ErrNotExist) {
7877
pathsToDelete = append(pathsToDelete, p.ContainerPath)
7978
} else {
80-
pathsToCopy = append(pathsToCopy, p)
79+
pathsToCopy = append(pathsToCopy, *p)
8180
}
8281
}
8382

0 commit comments

Comments
 (0)