Skip to content

Commit

Permalink
add restart action to watch attribute in the develop section
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <[email protected]>
  • Loading branch information
glours committed Oct 12, 2023
1 parent 2d32c3f commit b2c21f6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2842,6 +2842,14 @@ services:
# rebuild image and recreate service
- path: ./backend/src
action: rebuild
proxy:
image: example/proxy
build: ./proxy
develop:
watch:
# rebuild image and recreate service
- path: ./proxy/proxy.conf
action: restart
`, nil), func(options *Options) {
options.ResolvePaths = false
})
Expand All @@ -2868,4 +2876,14 @@ services:
},
},
})
proxy, err := project.GetService("proxy")
assert.NilError(t, err)
assert.DeepEqual(t, *proxy.Develop, types.DevelopConfig{
Watch: []types.Trigger{
{
Path: "./proxy/proxy.conf",
Action: types.WatchActionRestart,
},
},
})
}
2 changes: 1 addition & 1 deletion schema/compose-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
"properties": {
"ignore": {"type": "array", "items": {"type": "string"}},
"path": {"type": "string"},
"action": {"type": "string", "enum": ["rebuild", "sync"]},
"action": {"type": "string", "enum": ["rebuild", "sync", "restart"]},
"target": {"type": "string"}
}
},
Expand Down
1 change: 1 addition & 0 deletions types/develop.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type WatchAction string
const (
WatchActionSync WatchAction = "sync"
WatchActionRebuild WatchAction = "rebuild"
WatchActionRestart WatchAction = "restart"
)

type Trigger struct {
Expand Down

0 comments on commit b2c21f6

Please sign in to comment.