Skip to content

Commit 3d07b9f

Browse files
committed
add restart action to watch attribute in the develop section
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 2d32c3f commit 3d07b9f

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

loader/loader_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,6 +2842,14 @@ services:
28422842
# rebuild image and recreate service
28432843
- path: ./backend/src
28442844
action: rebuild
2845+
proxy:
2846+
image: example/proxy
2847+
build: ./proxy
2848+
develop:
2849+
watch:
2850+
# rebuild image and recreate service
2851+
- path: ./proxy/proxy.conf
2852+
action: sync+restart
28452853
`, nil), func(options *Options) {
28462854
options.ResolvePaths = false
28472855
})
@@ -2868,4 +2876,14 @@ services:
28682876
},
28692877
},
28702878
})
2879+
proxy, err := project.GetService("proxy")
2880+
assert.NilError(t, err)
2881+
assert.DeepEqual(t, *proxy.Develop, types.DevelopConfig{
2882+
Watch: []types.Trigger{
2883+
{
2884+
Path: "./proxy/proxy.conf",
2885+
Action: types.WatchActionSyncRestart,
2886+
},
2887+
},
2888+
})
28712889
}

schema/compose-spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@
475475
"properties": {
476476
"ignore": {"type": "array", "items": {"type": "string"}},
477477
"path": {"type": "string"},
478-
"action": {"type": "string", "enum": ["rebuild", "sync"]},
478+
"action": {"type": "string", "enum": ["rebuild", "sync", "sync+restart"]},
479479
"target": {"type": "string"}
480480
}
481481
},

types/develop.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ type DevelopConfig struct {
2323
type WatchAction string
2424

2525
const (
26-
WatchActionSync WatchAction = "sync"
27-
WatchActionRebuild WatchAction = "rebuild"
26+
WatchActionSync WatchAction = "sync"
27+
WatchActionRebuild WatchAction = "rebuild"
28+
WatchActionSyncRestart WatchAction = "sync+restart"
2829
)
2930

3031
type Trigger struct {

0 commit comments

Comments
 (0)