diff --git a/plugin/parse.go b/plugin/parse.go index d399d13..0f69ec8 100644 --- a/plugin/parse.go +++ b/plugin/parse.go @@ -92,7 +92,11 @@ func parsePipelines(data string, build drone.Build, repo drone.Repo, token strin "name": repo.Name, }).Infoln("excluding pipeline", resource.Attrs["name"]) - resource.Trigger.Event.Exclude = []string{"*"} + // if only Trigger.Paths is set, Trigger.Attrs will be unset, so it must be initialized + if resource.Trigger.Attrs == nil { + resource.Trigger.Attrs = make(map[string]interface{}) + } + resource.Trigger.Attrs["event"] = map[string][]string{"exclude": []string{"*"}} } } @@ -135,7 +139,11 @@ func parsePipelines(data string, build drone.Build, repo drone.Repo, token strin "name": repo.Name, }).Infoln("excluding step", step.Attrs["name"]) - step.When.Event.Exclude = []string{"*"} + // if only When.Paths is set, When.Attrs will be unset, so it must be initialized + if step.When.Attrs == nil { + step.When.Attrs = make(map[string]interface{}) + } + step.When.Attrs["event"] = map[string][]string{"exclude": []string{"*"}} } } } diff --git a/plugin/plugin.go b/plugin/plugin.go index 30b788a..96139e6 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -35,7 +35,6 @@ type ( } conditions struct { - Event condition `yaml:"event,omitempty"` Paths condition `yaml:"paths,omitempty"` Attrs map[string]interface{} `yaml:",inline"` } @@ -96,6 +95,13 @@ func (p *plugin) Convert(ctx context.Context, req *converter.Request) (*drone.Co data := req.Config.Data resources, pathsSeen, err := parsePipelines(data, req.Build, req.Repo, p.token) if err != nil { + logrus.WithFields(logrus.Fields{ + "action": req.Build.Action, + "after": req.Build.After, + "before": req.Build.Before, + "namespace": req.Repo.Namespace, + "name": req.Repo.Name, + }).Errorln(err) return nil, nil }