Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateRule(r *Rule, repos repograph.Map) error
- type Blacklist
- func (b *Blacklist) AddRule(r *Rule, repos repograph.Map) error
- func (b *Blacklist) Close() error
- func (b *Blacklist) GetRules() []*Rule
- func (b *Blacklist) Match(taskSpec, commit string) bool
- func (b *Blacklist) MatchRule(taskSpec, commit string) string
- func (b *Blacklist) RemoveRule(id string) error
- func (b *Blacklist) Update() error
- type Rule
Constants ¶
const ( // Collection name for blacklist entries. COLLECTION_BLACKLISTS = "blacklist_rules" // We'll perform this many attempts for a given request. DEFAULT_ATTEMPTS = 3 // Timeouts for various requests. TIMEOUT_GET = 60 * time.Second TIMEOUT_PUT = 10 * time.Second MAX_NAME_CHARS = 50 )
Variables ¶
var (
ERR_NO_SUCH_RULE = fmt.Errorf("No such rule.")
)
Functions ¶
Types ¶
type Blacklist ¶
type Blacklist struct {
// contains filtered or unexported fields
}
Blacklist is a struct which contains rules specifying tasks which should not be scheduled.
func (*Blacklist) Match ¶
Match determines whether the given taskSpec/commit pair matches one of the Rules in the Blacklist.
func (*Blacklist) MatchRule ¶
MatchRule determines whether the given taskSpec/commit pair matches one of the Rules in the Blacklist. Returns the name of the matched Rule or the empty string if no Rules match.
func (*Blacklist) RemoveRule ¶
RemoveRule removes the Rule from the Blacklist.
type Rule ¶
type Rule struct { AddedBy string `json:"added_by"` TaskSpecPatterns []string `json:"task_spec_patterns"` Commits []string `json:"commits"` Description string `json:"description"` Name string `json:"name"` }
Rule is a struct which indicates a specific task or set of tasks which should not be scheduled.
TaskSpecPatterns consists of regular expressions used to match taskSpecs which should not be triggered according to this Rule.
Commits are simply commit hashes for which the rule applies. If the list is empty, the Rule applies for all commits.
A Rule should specify TaskSpecPatterns or Commits or both.