notify

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package notify posts one sweep summary per team to the team's channel, through klaus-gateway's team-notice endpoint (POST /notices). The gateway owns the Slack app and the workspace credential; the sweep holds none.

The caller authenticates as itself: the projected ServiceAccount token the pod already carries, for the audience the gateway reviews. The file is read per call because the kubelet rotates it.

The summary is the run history of the scheduled sweep: no report repository and no database, so a channel that fills with runs that changed nothing stops being read. Silence is therefore part of the contract, and Client.Post refuses an empty message rather than posting a heartbeat.

Index

Constants

View Source
const (
	URLEnv       = "MARGE_NOTICES_URL"
	TokenFileEnv = "MARGE_NOTICES_TOKEN_FILE"
)

URLEnv carries the gateway's in-cluster base URL, TokenFileEnv the path of the projected ServiceAccount token.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// BaseURL is the gateway as reached from the pod, without a trailing
	// path.
	BaseURL string
	// TokenFile holds the projected ServiceAccount token, read per post.
	TokenFile string
	HTTP      *http.Client
}

Client posts notices.

func LoadClient

func LoadClient() *Client

LoadClient returns the client the environment configures, or nil when it names no gateway, which is not an error: a sweep run by hand posts nothing. The caller reports the summary on its own output either way.

func (*Client) Post

func (c *Client) Post(ctx context.Context, team, channel, text string) error

Post sends text to channel as team's notice. An empty channel or an empty text is an error: both mean the caller decided to post and then had nothing to say.

Jump to

Keyboard shortcuts

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