notification

package
v0.103.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Info    level = iota // Informational messages
	Success              // Successful operations
	Warning              // Warning messages indicating potential issues
	Failure              // Error messages indicating failure of operations
)

Variables

View Source
var ErrInvalidTemplate = errors.New("invalid notification template")

ErrInvalidTemplate is returned when the configured notification body template fails to parse or execute.

View Source
var ErrNotifyFailed = errors.New("request to apprise failed")

ErrNotifyFailed is returned when the Apprise request fails due to invalid notify URLs or unreachable service.

Functions

func GetRevision added in v0.32.1

func GetRevision(reference, commitSHA string) string

func Send

func Send(level level, title, message string, metadata Metadata, opts ...SendOption) error

Send sends a notification using the Apprise service based on the provided configuration and parameters.

func SetAppriseConfig

func SetAppriseConfig(apiURL, notifyUrls, notifyLevel, bodyTemplate string) error

SetAppriseConfig sets the configuration for the Apprise notification service. bodyTemplate is an optional Go text/template rendering the notification body; an empty string keeps the built-in format (defaultTemplate). An invalid template is rejected.

Types

type Metadata added in v0.32.1

type Metadata struct {
	Repository          string
	Stack               string
	Context             string // Docker context the stack is deployed to (empty = default context)
	Revision            string
	JobID               string
	TraceID             string
	ReconciliationEvent string
	AffectedActorKind   string
	AffectedActorID     string
	AffectedActorName   string
}

type SendOption added in v0.103.0

type SendOption func(*sendOptions)

SendOption customizes how a notification is rendered/sent.

func WithoutBodyTemplate added in v0.103.0

func WithoutBodyTemplate() SendOption

WithoutBodyTemplate renders the notification with the built-in body format, ignoring any configured APPRISE_NOTIFY_BODY_TEMPLATE. Use it for app-level notifications (e.g. the "new version available" ping) that are not tied to a deployment and therefore carry no stack/context/revision the template expects.

type TemplateData added in v0.103.0

type TemplateData struct {
	Level            string // notification level: info, success, warning or failure
	Emoji            string // level emoji (ℹ️/✅/⚠️/❌)
	Title            string // notification title, e.g. "Deployment completed"
	Message          string // core notification message
	IsReconciliation bool   // true when triggered by a reconciliation event
	Metadata                // embedded metadata fields
}

TemplateData is the data exposed to a user-configured notification body template. Metadata is embedded, so its fields (Repository, Stack, Revision, JobID, ...) are referenced directly, e.g. {{.Stack}} or {{.Repository}}.

func (TemplateData) DefaultBody added in v0.103.0

func (d TemplateData) DefaultBody() string

DefaultBody renders the built-in notification body: the message text followed by structured metadata. It backs defaultTemplate and is exposed to user templates as {{ .DefaultBody }}.

Jump to

Keyboard shortcuts

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