sync

package
v0.0.0-...-4714bb5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BotName is the name of merge-bot
	BotName = "k8s-merge-robot"
	// JenkinsBotName is the name of kubekins bot
	JenkinsBotName = "k8s-bot"

	// PriorityP0 represents Priority P0
	PriorityP0 = Priority(0)
	// PriorityP1 represents Priority P1
	PriorityP1 = Priority(1)
	// PriorityP2 represents Priority P2
	PriorityP2 = Priority(2)
	// PriorityP3 represents Priority P3
	PriorityP3 = Priority(3)
)

Variables

RobotUser is a set of name of robot user

Functions

This section is empty.

Types

type IssueFinder

type IssueFinder interface {
	AllIssuesForKey(key string) []int
	Created(key string, number int)
}

IssueFinder finds an issue for a given key.

type IssueSource

type IssueSource interface {
	// Title is used to identify issues, so you must never change the
	// mechanism or you'll get duplicates.
	Title() string

	// If ID() is found in either the body of the issue or the body of any
	// of its comments, then a new comment doesn't need to be made. A URL
	// to more details is a good choice.
	// Additionally, ID is used to tell if we've already successfully
	// synced a given source. So it must be unique for every source.
	ID() string

	// If a new issue or comment must be made, Body is called to get the
	// text. Body *must* contain the output of ID().
	// newIssue will be true if we are starting a new issue, otherwise we
	// are adding a comment to an existing issue.
	Body(newIssue bool) string

	// AddTo attempts to merge Body into the output of another IssueSource's Body.
	// If this is sensible and valid, it returns the new body. An empty string indicates
	// a failure to merge the two.
	AddTo(previous string) string

	// If an issue is filed, these labels will be applied.
	Labels() []string

	// Priority calculates and returns the priority of an flake issue
	Priority(obj *github.MungeObject) (Priority, bool)
}

IssueSource can be implemented by anything that wishes to be synced with github issues.

type IssueSyncer

type IssueSyncer struct {
	// contains filtered or unexported fields
}

IssueSyncer implements robust issue syncing logic and won't file duplicates etc.

func NewIssueSyncer

func NewIssueSyncer(config *github.Config, finder IssueFinder, owner OwnerMapper) *IssueSyncer

NewIssueSyncer constructs an issue syncer.

func (*IssueSyncer) Sync

func (s *IssueSyncer) Sync(source IssueSource) error

Sync syncs the issue. It is fine and cheap to call Sync repeatedly for the same source.

type OwnerMapper

type OwnerMapper interface {
	// TestOwner returns a GitHub username for a test, or "" if none are found.
	TestOwner(testName string) string
}

OwnerMapper finds an owner for a given test name.

type Priority

type Priority int

Priority represents the priority label in an issue

func (Priority) Priority

func (p Priority) Priority() int

Priority returns the priority in int

func (Priority) String

func (p Priority) String() string

String return the priority label in string

Jump to

Keyboard shortcuts

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