(ctx context.Context, rep repo.Repository, severity Severity)
| 87 | } |
| 88 | |
| 89 | func notificationSendersFromRepo(ctx context.Context, rep repo.Repository, severity Severity) ([]sender.Sender, error) { |
| 90 | profiles, err := notifyprofile.ListProfiles(ctx, rep) |
| 91 | if err != nil { |
| 92 | return nil, errors.Wrap(err, "unable to list notification profiles") |
| 93 | } |
| 94 | |
| 95 | var result []sender.Sender |
| 96 | |
| 97 | for _, p := range profiles { |
| 98 | if severity < p.MinSeverity { |
| 99 | continue |
| 100 | } |
| 101 | |
| 102 | s, err := sender.GetSender(ctx, p.ProfileName, p.MethodConfig.Type, p.MethodConfig.Config) |
| 103 | if err != nil { |
| 104 | log(ctx).Warnw("unable to create sender for notification profile", "profile", p.ProfileName, "err", err) |
| 105 | continue |
| 106 | } |
| 107 | |
| 108 | result = append(result, s) |
| 109 | } |
| 110 | |
| 111 | return result, nil |
| 112 | } |
| 113 | |
| 114 | // Send sends a notification for the given event. |
| 115 | // Any errors encountered during the process are logged. |
no test coverage detected