Documentation
¶
Index ¶
- func EventTargetsFromEvent(ctx context.Context, db *gorm.DB, event signal.SignalPhaseEvent, ...) labels.EventTargets
- type Params
- type SlackParams
- type SlackSignalLifecycleHook
- func (h *SlackSignalLifecycleHook) AfterPhase(ctx context.Context, event signal.SignalPhaseEvent, ...) error
- func (h *SlackSignalLifecycleHook) BeforePhase(ctx context.Context, event signal.SignalPhaseEvent) (signal.BeforePhaseDecision, error)
- func (h *SlackSignalLifecycleHook) Name() string
- func (h *SlackSignalLifecycleHook) Supports(event signal.SignalPhaseEvent) bool
- type WebhookSignalLifecycleHook
- func (h *WebhookSignalLifecycleHook) AfterPhase(ctx context.Context, event signal.SignalPhaseEvent, ...) error
- func (h *WebhookSignalLifecycleHook) BeforePhase(ctx context.Context, event signal.SignalPhaseEvent) (signal.BeforePhaseDecision, error)
- func (h *WebhookSignalLifecycleHook) Name() string
- func (h *WebhookSignalLifecycleHook) Supports(event signal.SignalPhaseEvent) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventTargetsFromEvent ¶ added in v0.19.927
func EventTargetsFromEvent(ctx context.Context, db *gorm.DB, event signal.SignalPhaseEvent, data lifecycleEventData) labels.EventTargets
EventTargetsFromEvent resolves the entity ids referenced by a lifecycle event into the labels.EventTargets shape consumed by SubscriptionMatch. Each id is best-effort and may be empty — Match.matches treats an empty id as "no entity of this kind on the event" so a component-only event never falsely satisfies an installs filter.
Install resolution mirrors the legacy installIDFromEvent path verbatim (event.OwnerType, data.Workflow.OwnerType, then step-derived lookups for install_deploys / install_sandbox_runs / install_sandboxes). Component and action resolution layer alongside without disturbing it.
This is the package-level implementation shared by the slack and webhook signal hooks. Both callers pass their own *gorm.DB; nil db is tolerated (lookup steps simply return empty ids, owner-type-derived ids still flow through).
Types ¶
type SlackParams ¶ added in v0.19.927
type SlackParams struct {
fx.In
Cfg *internal.Config `optional:"true"`
L *zap.Logger `optional:"true"`
DB *gorm.DB `name:"psql" optional:"true"`
SlackClient *slackclient.Client `optional:"true"`
MW metrics.Writer `optional:"true"`
}
SlackParams declares the dependencies for the Slack signal lifecycle hook. All fields are optional (mirroring webhook.go's defensive constructor) so the hook can be wired into FX even when Slack isn't configured locally.
type SlackSignalLifecycleHook ¶ added in v0.19.927
type SlackSignalLifecycleHook struct {
// contains filtered or unexported fields
}
SlackSignalLifecycleHook fans out workflow / step / approval lifecycle events to all active SlackChannelSubscriptions for the event's org.
Routing invariant (mirrors the model docs): a message lands in workspace T for org O iff installation T is active, org_link (T, O) is verified, and a channel sub (T, channel, O) is active. The hook resolves all three via per-event GORM lookups and posts via the handwritten Slack client.
Threading: per-(team, channel, workflow) anchor rows in slack_thread_anchors drive a parent post + threaded children pattern. The first event posts a parent, persists its ts, and threads itself under that parent. Subsequent events thread under the cached parent and best-effort edit the parent's rollup. Nested action_workflow_run sub-workflows are consolidated under the launching deploy step's workflow via the parent lookup.
Most enrichment helpers (enrichStep, lookupParent, buildContextLinks, lookupDeployTargetMeta, lookupSandboxRunTargetMeta, lookupApprovalResponse) live on WebhookSignalLifecycleHook in webhook.go and are reused via a lightweight delegate so both hooks share one source of truth for payload shape.
func NewSlackSignalLifecycleHook ¶ added in v0.19.927
func NewSlackSignalLifecycleHook(params SlackParams) *SlackSignalLifecycleHook
NewSlackSignalLifecycleHook constructs the Slack lifecycle hook. Returns a non-nil hook even when dependencies are missing — Supports() short-circuits at runtime so the dispatcher cost stays cheap when Slack isn't configured.
func (*SlackSignalLifecycleHook) AfterPhase ¶ added in v0.19.927
func (h *SlackSignalLifecycleHook) AfterPhase(ctx context.Context, event signal.SignalPhaseEvent, outcome signal.SignalPhaseOutcome) error
func (*SlackSignalLifecycleHook) BeforePhase ¶ added in v0.19.927
func (h *SlackSignalLifecycleHook) BeforePhase(ctx context.Context, event signal.SignalPhaseEvent) (signal.BeforePhaseDecision, error)
func (*SlackSignalLifecycleHook) Name ¶ added in v0.19.927
func (h *SlackSignalLifecycleHook) Name() string
func (*SlackSignalLifecycleHook) Supports ¶ added in v0.19.927
func (h *SlackSignalLifecycleHook) Supports(event signal.SignalPhaseEvent) bool
Supports limits this hook to the public lifecycle primitives (matches the webhook hook's filter) and short-circuits when Slack isn't wired so the dispatcher doesn't pay the per-event cost.
type WebhookSignalLifecycleHook ¶
type WebhookSignalLifecycleHook struct {
// contains filtered or unexported fields
}
func NewWebhookSignalLifecycleHook ¶
func NewWebhookSignalLifecycleHook(params Params) *WebhookSignalLifecycleHook
func (*WebhookSignalLifecycleHook) AfterPhase ¶
func (h *WebhookSignalLifecycleHook) AfterPhase(ctx context.Context, event signal.SignalPhaseEvent, outcome signal.SignalPhaseOutcome) error
func (*WebhookSignalLifecycleHook) BeforePhase ¶
func (h *WebhookSignalLifecycleHook) BeforePhase(ctx context.Context, event signal.SignalPhaseEvent) (signal.BeforePhaseDecision, error)
func (*WebhookSignalLifecycleHook) Name ¶
func (h *WebhookSignalLifecycleHook) Name() string
func (*WebhookSignalLifecycleHook) Supports ¶
func (h *WebhookSignalLifecycleHook) Supports(event signal.SignalPhaseEvent) bool
Supports limits this hook to the public lifecycle primitives: execute-workflow (workflow lifecycle), execute-workflow-step (step lifecycle), and the approval handshake signals (request / response) which are projected as workflow_step.approval.v1 events. Inner-signal events (plan/apply, component-deploy, etc.) are deliberately ignored — consumers should reason in terms of workflow + step + approval.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package slackrender renders Slack message text and blocks for Nuon workflow / workflow_step / workflow_step_approval lifecycle events.
|
Package slackrender renders Slack message text and blocks for Nuon workflow / workflow_step / workflow_step_approval lifecycle events. |