Skip to content

Commit

Permalink
introduce restart watch action
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Dec 11, 2024
1 parent 9a9cc5d commit 27dbf49
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion loader/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func checkConsistency(project *types.Project) error {

if s.Develop != nil && s.Develop.Watch != nil {
for _, watch := range s.Develop.Watch {
if watch.Action != types.WatchActionRebuild && watch.Target == "" {
if watch.Target == "" && watch.Action != types.WatchActionRebuild && watch.Action != types.WatchActionRestart {
return fmt.Errorf("services.%s.develop.watch: target is required for non-rebuild actions: %w", s.Name, errdefs.ErrInvalid)
}
}
Expand Down
2 changes: 1 addition & 1 deletion schema/compose-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@
"properties": {
"ignore": {"type": "array", "items": {"type": "string"}},
"path": {"type": "string"},
"action": {"type": "string", "enum": ["rebuild", "sync", "sync+restart", "sync+exec"]},
"action": {"type": "string", "enum": ["rebuild", "sync", "restart", "sync+restart", "sync+exec"]},
"target": {"type": "string"},
"exec": {"$ref": "#/definitions/service_hook"}
},
Expand Down
1 change: 1 addition & 0 deletions types/develop.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type WatchAction string
const (
WatchActionSync WatchAction = "sync"
WatchActionRebuild WatchAction = "rebuild"
WatchActionRestart WatchAction = "restart"
WatchActionSyncRestart WatchAction = "sync+restart"
WatchActionSyncExec WatchAction = "sync+exec"
)
Expand Down

0 comments on commit 27dbf49

Please sign in to comment.