notify

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notify defines the notification seam fired on finding deltas (new blocker, became-ready, add-on entering the EOL window) — never on every snapshot. Implementations (Slack, generic webhook) live here too.

The server computes *what* changed (delta rules live in internal/server); this package only knows how to deliver an Event somewhere. All notifiers are best-effort: delivery failures must never block snapshot ingestion, so Multi logs individual failures and always returns nil.

Index

Constants

View Source
const (
	KindNewBlocker     = "new-blocker"
	KindEOLApproaching = "eol-approaching"
	KindBecameReady    = "became-ready"
)

Kind values for Event.Kind (the only three the delta rules emit).

Variables

This section is empty.

Functions

func FormatLine

func FormatLine(ev Event) string

FormatLine renders the canonical one-line notification text:

[upgradescope] <cluster> → <target>: <kind>: <title>

Types

type Event

type Event struct {
	Cluster string
	Target  string
	Kind    string // "new-blocker" | "eol-approaching" | "became-ready"
	Title   string // human line, e.g. finding title
	Detail  string
}

type GenericWebhook

type GenericWebhook struct {
	URL    string
	Client *http.Client
}

GenericWebhook POSTs the raw Event as JSON to any HTTP endpoint.

func NewGenericWebhook

func NewGenericWebhook(url string) *GenericWebhook

NewGenericWebhook returns a GenericWebhook with the 2s delivery timeout.

func (*GenericWebhook) Notify

func (g *GenericWebhook) Notify(ctx context.Context, ev Event) error

type NopNotifier

type NopNotifier struct{}

NopNotifier discards every event. Useful default when no webhook is configured.

func (NopNotifier) Notify

type Notifier

type Notifier interface {
	Notify(ctx context.Context, ev Event) error
}

func Multi

func Multi(notifiers ...Notifier) Notifier

Multi fans one event out to every notifier. Individual failures are logged and skipped — the remaining notifiers still fire and the error is never propagated (best-effort delivery, contract: "failures logged, never block ingestion"). Multi() with no arguments is a valid no-op.

type SlackNotifier

type SlackNotifier struct {
	URL    string
	Client *http.Client // exported so tests shorten the timeout; never nil from NewSlack
}

SlackNotifier posts events to a Slack incoming webhook as plain text.

func NewSlack

func NewSlack(url string) *SlackNotifier

NewSlack returns a SlackNotifier with the 2s delivery timeout.

func (*SlackNotifier) Notify

func (s *SlackNotifier) Notify(ctx context.Context, ev Event) error

Jump to

Keyboard shortcuts

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