Documentation ¶
Index ¶
Constants ¶
const ( MatchResultUndefined MatchResult = 0 EventSourceMismatch = iota RuleMismatch Match )
const DefRetryTimeout = 2 * time.Hour
const DefTimeout = 24 * time.Hour
DefTimeout is used as timeout for runs when the passed context has no deadline set.
Variables ¶
This section is empty.
Functions ¶
func WithActionRoutineDeferFunc ¶
func WithActionRoutineDeferFunc(fn func()) func(*EvLoop)
WithActionRoutineDeferFunc sets a function to be run when an go-routine that executes an action returns. It can be used to set a panic handler. Because it does not pass any arguments, there is probably no other good usecase for it. :-)
Types ¶
type ActionConfig ¶
type ActionConfig interface { // Render runs renderFunc for all configuration options of the // action that are templated and returns a runnable action. Render(event action.Event, renderFunc func(string) (string, error)) (action.Runner, error) // String returns a short representation of the ActionConfig String() string // String returns a formatted detailed description. DetailedString() string }
ActionConfig is an interface for an action that is executed as part of a Rule.
type EvLoop ¶
type EvLoop struct {
// contains filtered or unexported fields
}
EvLoop receives events and triggers matching actions. Actions are executed asynchronously in go-routines and are retried until DefRetryTimeout expired.
func NewEventLoop ¶
type Event ¶ added in v0.8.0
type Event struct { JSON []byte Provider string // Github hook fields, if the value is not available they are empty // strings. DeliveryID string EventType string RepositoryOwner string Repository string BaseBranch string CommitID string Branch string // PullRequestNr is 0 if it's not available PullRequestNr int LogFields []zap.Field }
Event is processed by the event-loop and used for templating actions. It's public fields are accessible via template statements defined in the goordinater config file.
func (*Event) GetPullRequestNr ¶ added in v0.8.0
func (*Event) GetRepository ¶ added in v0.8.0
func (*Event) GetRepositoryOwner ¶ added in v0.8.0
type MatchResult ¶
type MatchResult uint8
MatchResult represents the result matching a rule against an event.
func (*MatchResult) String ¶
func (m *MatchResult) String() string
type Retryer ¶ added in v0.8.0
type Retryer struct {
// contains filtered or unexported fields
}
Retryer executes a function repeatedly until it was successful or it's context was cancelled.
func NewRetryer ¶ added in v0.8.0
func NewRetryer() *Retryer
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
Rule defines the condition that must apply for an event and the actions that are run when conditions match.
func NewRule ¶
func NewRule(name, eventProvider, jqQuery string, actions []ActionConfig) (*Rule, error)