Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce sync+exec watch action #715

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions schema/compose-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,9 @@
"properties": {
"ignore": {"type": "array", "items": {"type": "string"}},
"path": {"type": "string"},
"action": {"type": "string", "enum": ["rebuild", "sync", "sync+restart"]},
"target": {"type": "string"}
"action": {"type": "string", "enum": ["rebuild", "sync", "sync+restart", "sync+exec"]},
"target": {"type": "string"},
"exec": {"$ref": "#/definitions/service_hook"}
},
"additionalProperties": false,
"patternProperties": {"^x-": {}}
Expand Down
19 changes: 19 additions & 0 deletions types/derived.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions types/develop.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const (
WatchActionSync WatchAction = "sync"
WatchActionRebuild WatchAction = "rebuild"
WatchActionSyncRestart WatchAction = "sync+restart"
WatchActionSyncExec WatchAction = "sync+exec"
)

type Trigger struct {
Path string `yaml:"path" json:"path"`
Action WatchAction `yaml:"action" json:"action"`
Target string `yaml:"target,omitempty" json:"target,omitempty"`
Exec ServiceHook `yaml:"exec,omitempty" json:"exec,omitempty"`
Ignore []string `yaml:"ignore,omitempty" json:"ignore,omitempty"`
Extensions Extensions `yaml:"#extensions,inline,omitempty" json:"-"`
}
10 changes: 10 additions & 0 deletions types/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ func (m MappingWithEquals) RemoveEmpty() MappingWithEquals {
return m
}

func (m MappingWithEquals) ToMapping() Mapping {
o := Mapping{}
for k, v := range m {
if v != nil {
o[k] = *v
}
}
return o
}

func (m *MappingWithEquals) DecodeMapstructure(value interface{}) error {
switch v := value.(type) {
case map[string]interface{}:
Expand Down