in slack/main.go [80:105]
func (s *slackNotifier) SendNotification(ctx context.Context, build *cbpb.Build) error {
if !s.filter.Apply(ctx, build) {
return nil
}
log.Infof("sending Slack webhook for Build %q (status: %q)", build.Id, build.Status)
bindings, err := s.br.Resolve(ctx, nil, build)
if err != nil {
return fmt.Errorf("failed to resolve bindings: %w", err)
}
s.tmplView = ¬ifiers.TemplateView{
Build: ¬ifiers.BuildView{Build: build},
Params: bindings,
}
msg, err := s.writeMessage()
if err != nil {
return fmt.Errorf("failed to write Slack message: %w", err)
}
return slack.PostWebhook(s.webhookURL, msg)
}