Skip to content

Commit

Permalink
Merge pull request #469 from glours/watch-restart
Browse files Browse the repository at this point in the history
add restart action to watch attribute in the develop section
  • Loading branch information
glours committed Oct 17, 2023
2 parents 2d32c3f + 3d07b9f commit 726d8b0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
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: sync+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.WatchActionSyncRestart,
},
},
})
}
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", "sync+restart"]},
"target": {"type": "string"}
}
},
Expand Down
5 changes: 3 additions & 2 deletions types/develop.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ type DevelopConfig struct {
type WatchAction string

const (
WatchActionSync WatchAction = "sync"
WatchActionRebuild WatchAction = "rebuild"
WatchActionSync WatchAction = "sync"
WatchActionRebuild WatchAction = "rebuild"
WatchActionSyncRestart WatchAction = "sync+restart"
)

type Trigger struct {
Expand Down

0 comments on commit 726d8b0

Please sign in to comment.