notify

package
v0.0.0-...-ee3d319 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RunnerName = "notify.legacy"

	// Thus on each run of the notifier, we check if the last notification time
	// (LNT) is within this window. If it is, then we use the retrieved LNT.
	// If not, we use the current time
	LNRWindow = 60 * time.Minute

	// MCI ops notification prefaces
	ProvisionFailurePreface = "[PROVISION-FAILURE]"
	ProvisionTimeoutPreface = "[PROVISION-TIMEOUT]"
	ProvisionLatePreface    = "[PROVISION-LATE]"
	TeardownFailurePreface  = "[TEARDOWN-FAILURE]"

	// repotracker notification prefaces
	RepotrackerFailurePreface = "[REPOTRACKER-FAILURE %v] on %v"

	// branch name to use if the project reference is not found
	UnknownProjectBranch = ""

	DefaultNotificationsConfig = "/etc/mci-notifications.yml"
)

Variables

This section is empty.

Functions

func NotifyAdmins

func NotifyAdmins(subject, msg string, settings *evergreen.Settings) error

NotifyAdmins is a helper method to send a notification to the MCI admin team

func TrySendNotification

func TrySendNotification(recipients []string, subject, body string, mailer Mailer) (err error)

Helper function to send notifications

func TrySendNotificationToUser

func TrySendNotificationToUser(userId string, subject, body string, mailer Mailer) error

Types

type Mailer

type Mailer interface {
	SendMail([]string, string, string) error
}

func ConstructMailer

func ConstructMailer(notifyConfig evergreen.NotifyConfig) Mailer

type SmtpMailer

type SmtpMailer struct {
	From     string
	Server   string
	Port     int
	UseSSL   bool
	Username string
	Password string
}

func (SmtpMailer) SendMail

func (self SmtpMailer) SendMail(recipients []string, subject, body string) error

Connects an SMTP server (usually localhost:25 in prod) and uses that to

send an email with the body encoded in base64.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL