Skip to content

Commit

Permalink
chore: send deployment failure notifs to alerts channel (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
smrz2001 committed Jun 6, 2024
1 parent 166d4ac commit cc9fc28
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit cc9fc28

Please sign in to comment.