Documentation
¶
Index ¶
- Constants
- func AvailableFields() []string
- func FormatValue(value any) string
- func Marshal(settings Settings) ([]byte, error)
- func Template() []byte
- func Validate(settings Settings) error
- func WebBaseDirID(baseDir string) string
- type Batch
- type BrowserMessage
- type ChannelSettings
- type Event
- type EventKind
- type Field
- type Loaded
- type Payload
- type PayloadEvent
- type Settings
- type WebhookSettings
Constants ¶
const FileName = "notifications.toml"
const WebBaseDirRoutePrefix = "/_basedir/"
WebBaseDirRoutePrefix is the Web UI path prefix that serves one basedir as WebBaseDirRoutePrefix + WebBaseDirID(baseDir) + "/".
Variables ¶
This section is empty.
Functions ¶
func AvailableFields ¶
func AvailableFields() []string
AvailableFields returns every field in its default display order.
func FormatValue ¶
func WebBaseDirID ¶ added in v0.1.21
WebBaseDirID returns the Web UI route ID of baseDir, an absolute, clean path.
Types ¶
type Batch ¶
type BrowserMessage ¶ added in v0.1.24
type BrowserMessage struct {
Title string `json:"title"`
Body string `json:"body"`
// Link reports whether the message opens its run, which the "link" field
// selects.
Link bool `json:"link"`
}
BrowserMessage is one browser notification: an inbox entry and, for a page that sees it arrive, a desktop notification.
func NewBrowserMessage ¶ added in v0.1.24
func NewBrowserMessage(events []Event, settings ChannelSettings) (BrowserMessage, bool)
NewBrowserMessage renders one run's events with browser settings. Selected job failures, then job successes, each up to settings.MaxJobs, and the run's completion become sections of "field name: value" lines in settings.Fields order. It reports false when settings select none of the events.
type ChannelSettings ¶
type ChannelSettings struct {
JobFailure bool `json:"job_failure"`
JobSuccess bool `json:"job_success"`
RunFailure bool `json:"run_failure"`
RunSuccess bool `json:"run_success"`
Fields []string `json:"fields"`
MaxJobs int `json:"max_jobs"`
}
func (ChannelSettings) Includes ¶
func (settings ChannelSettings) Includes(event Event) bool
type Event ¶
type Event struct {
Kind EventKind `json:"event"`
OccurredAt string `json:"occurred_at"`
Project string `json:"project,omitempty"`
RunID string `json:"run_id,omitempty"`
RunName string `json:"run_name,omitempty"`
RunStatus string `json:"run_status,omitempty"`
JobStatus string `json:"job_status,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Successes int `json:"success_count,omitempty"`
Failures int `json:"failure_count,omitempty"`
DiagnosisOutdated bool `json:"diagnosis_outdated,omitempty"`
Job *model.JobSpec `json:"job,omitempty"`
Result *model.JobResult `json:"result,omitempty"`
StartedAt string `json:"started_at,omitempty"`
FinishedAt string `json:"finished_at,omitempty"`
}
func NewInterruptedRunEvent ¶ added in v0.1.24
NewInterruptedRunEvent reports run, which has its ID and, when they were recorded, its name and start time, as interrupted.
func NewJobEvent ¶
func NewRunEvent ¶
func (Event) Recordable ¶ added in v0.1.24
Recordable returns event with only the job and result facts that the shared field vocabulary reads, so a kept record carries no environment, executor options, or other job settings.
func (*Event) SetDiagnosisOutdated ¶
func (*Event) SetTimestamps ¶
type Payload ¶
type Payload struct {
SchemaVersion int `json:"schema_version"`
CreatedAt string `json:"created_at"`
Events []PayloadEvent `json:"events"`
OmittedJobs int `json:"omitted_jobs,omitempty"`
}
type PayloadEvent ¶
type Settings ¶
type Settings struct {
Webhook WebhookSettings `json:"webhook"`
Browser ChannelSettings `json:"browser"`
}
type WebhookSettings ¶
type WebhookSettings struct {
ChannelSettings
URL string `json:"url,omitempty"`
WebURL string `json:"web_url,omitempty"`
Format string `json:"format"`
}