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

chore: send deployment failure notifs to alerts channel #61

Merged
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
9 changes: 8 additions & 1 deletion cd/manager/notifs/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type deployNotif struct {
state job.JobState
deploymentsWebhook webhook.Client
communityWebhook webhook.Client
alertWebhook webhook.Client
env manager.EnvType
}

Expand All @@ -36,8 +37,10 @@ func newDeployNotif(jobState job.JobState) (jobNotif, error) {
return nil, err
} else if c, err := parseDiscordWebhookUrl("DISCORD_COMMUNITY_NODES_WEBHOOK"); err != nil {
return nil, err
} else if a, err := parseDiscordWebhookUrl("DISCORD_ALERT_WEBHOOK"); err != nil {
return nil, err
} else {
return &deployNotif{jobState, d, c, manager.EnvType(os.Getenv(manager.EnvVar_Env))}, nil
return &deployNotif{jobState, d, c, a, manager.EnvType(os.Getenv(manager.EnvVar_Env))}, nil
}
}

Expand All @@ -47,6 +50,10 @@ func (d deployNotif) getChannels() []webhook.Client {
if (d.env != manager.EnvType_Dev) && (d.env != manager.EnvType_Qa) {
webhooks = append(webhooks, d.communityWebhook)
}
// Also send deployment failures to the alerts channel
if d.state.Stage == job.JobStage_Failed {
webhooks = append(webhooks, d.alertWebhook)
}
return webhooks
}

Expand Down
Loading