Skip to content

Commit 956891a

Browse files
gloursndeloof
authored andcommitted
add support of develop.watch.initial_sync attribute
Signed-off-by: Guillaume Lours <[email protected]>
1 parent a473341 commit 956891a

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,5 @@ exclude (
209209
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
210210
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
211211
)
212+
213+
replace github.com/compose-spec/compose-go/v2 => github.com/compose-spec/compose-go/v2 v2.8.3-0.20250917164343-9a11fcb1e362

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004 h1:lkAMpLVBDaj17e
7878
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
7979
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE=
8080
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4=
81-
github.com/compose-spec/compose-go/v2 v2.8.2 h1:A1iVoZJUex7buGv1CpnC5uwNuyTMBYpDAmBnAQmia9Q=
82-
github.com/compose-spec/compose-go/v2 v2.8.2/go.mod h1:Oky9AZGTRB4E+0VbTPZTUu4Kp+oEMMuwZXZtPPVT1iE=
81+
github.com/compose-spec/compose-go/v2 v2.8.3-0.20250917164343-9a11fcb1e362 h1:FeJRGYVKTB5l6UVeoilkIJ3iAtBBdDMP/IaxOwSLc2s=
82+
github.com/compose-spec/compose-go/v2 v2.8.3-0.20250917164343-9a11fcb1e362/go.mod h1:Oky9AZGTRB4E+0VbTPZTUu4Kp+oEMMuwZXZtPPVT1iE=
8383
github.com/containerd/cgroups/v3 v3.0.5 h1:44na7Ud+VwyE7LIoJ8JTNQOa549a8543BmzaJHo6Bzo=
8484
github.com/containerd/cgroups/v3 v3.0.5/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins=
8585
github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc=

pkg/compose/watch.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,11 @@ func (s *composeService) watch(ctx context.Context, project *types.Project, opti
231231
if isSync(trigger) && checkIfPathAlreadyBindMounted(trigger.Path, service.Volumes) {
232232
logrus.Warnf("path '%s' also declared by a bind mount volume, this path won't be monitored!\n", trigger.Path)
233233
continue
234-
} else {
235-
var initialSync bool
236-
success, err := trigger.Extensions.Get("x-initialSync", &initialSync)
237-
if err == nil && success && initialSync && isSync(trigger) {
238-
// Need to check initial files are in container that are meant to be synced from watch action
239-
err := s.initialSync(ctx, project, service, trigger, syncer)
240-
if err != nil {
241-
return nil, err
242-
}
234+
} else if trigger.InitialSync && isSync(trigger) {
235+
// Need to check initial files are in container that are meant to be synced from watch action
236+
err := s.initialSync(ctx, project, service, trigger, syncer)
237+
if err != nil {
238+
return nil, err
243239
}
244240
}
245241
paths = append(paths, trigger.Path)

0 commit comments

Comments
 (0)