Documentation ¶
Index ¶
- func RegisterSourceOrDie(name string, src IssueSource)
- type Issue
- type IssueCreator
- func (c *IssueCreator) CreateAndSync()
- func (c *IssueCreator) ExplainTestAssignments(testNames []string) string
- func (c *IssueCreator) RegisterFlags()
- func (c *IssueCreator) TestOwner(testName string) string
- func (c *IssueCreator) TestSIG(testName string) string
- func (c *IssueCreator) TestsOwners(testNames []string) map[string][]string
- func (c *IssueCreator) TestsSIGs(testNames []string) map[string][]string
- type IssueSource
- type OwnerMapper
- type RepoClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSourceOrDie ¶
func RegisterSourceOrDie(name string, src IssueSource)
RegisterSourceOrDie registers a source of auto-filed issues.
Types ¶
type Issue ¶
type Issue interface { // Title yields the initial title text of the github issue. Title() string // Body yields the body text of the github issue and *must* contain the output of ID(). // closedIssues is a (potentially empty) slice containing all closed // issues authored by this bot that contain ID() in their body. // if Body returns an empty string no issue is created. Body(closedIssues []*github.Issue) string // ID returns a string that uniquely identifies this issue. // This ID must appear in the body of the issue. // DO NOT CHANGE how this ID is formatted or duplicate issues will be created // on github for this issue ID() string // Labels specifies the set of labels to apply to this issue on github. Labels() []string // Owners returns the github usernames to assign the issue to or nil/empty for no assignment. Owners() []string // Priority calculates and returns the priority of this issue // The returned bool indicates if the returned priority is valid and can be used Priority() (string, bool) }
Issue is an interface implemented by structs that can be synced with github issues via the IssueCreator.
type IssueCreator ¶
type IssueCreator struct { // Collaborators is the set of Users that are valid assignees for the current repo (populated from GH). Collaborators []string // maxSIGCount is the maximum number of SIG areas to include on a single github issue. MaxSIGCount int // maxAssignees is the maximum number of user to assign to a single github issue. MaxAssignees int // Owners is an OwnerMapper that maps test names to owners and SIG areas. Owners OwnerMapper // contains filtered or unexported fields }
IssueCreator handles syncing identified issues with github issues. This includes finding existing github issues, creating new ones, and ensuring that duplicate github issues are not created.
func (*IssueCreator) CreateAndSync ¶
func (c *IssueCreator) CreateAndSync()
CreateAndSync is the main workhorse function of IssueCreator. It initializes the IssueCreator, asks each source for its issues to sync, and syncs the issues.
func (*IssueCreator) ExplainTestAssignments ¶
func (c *IssueCreator) ExplainTestAssignments(testNames []string) string
ExplainTestAssignments returns a string explaining how tests caused the individual/sig assignments.
func (*IssueCreator) RegisterFlags ¶
func (c *IssueCreator) RegisterFlags()
RegisterFlags registers options for this munger; returns any that require a restart when changed.
func (*IssueCreator) TestOwner ¶
func (c *IssueCreator) TestOwner(testName string) string
TestOwner uses the IssueCreator's OwnerMapper to look up the user assigned to a test.
func (*IssueCreator) TestSIG ¶
func (c *IssueCreator) TestSIG(testName string) string
TestSIG uses the IssueCreator's OwnerMapper to look up the SIG for a test.
func (*IssueCreator) TestsOwners ¶
func (c *IssueCreator) TestsOwners(testNames []string) map[string][]string
TestsOwners uses the IssueCreator's OwnerMapper to look up the users assigned to a list of tests. The number of users returned is limited by MaxAssignees. The return value is a map from users to the test names from testNames that each user owns.
func (*IssueCreator) TestsSIGs ¶
func (c *IssueCreator) TestsSIGs(testNames []string) map[string][]string
TestsSIGs uses the IssueCreator's OwnerMapper to look up the SIGs for a list of tests. The number of SIGs returned is limited by MaxSIGCount. The return value is a map from sigs to the tests from testNames that each sig owns.
type IssueSource ¶
type IssueSource interface { Issues(*IssueCreator) ([]Issue, error) RegisterFlags() }
IssueSource represents a source of auto-filed issues, such as triage-filer or flakyjob-reporter.
type OwnerMapper ¶
type OwnerMapper interface { // TestOwner returns a GitHub username for a test, or "" if none are found. TestOwner(testName string) string // TestSIG returns the name of the Special Interest Group (SIG) which owns the test , or "" if none are found. TestSIG(testName string) string }
OwnerMapper finds an owner for a given test name.
type RepoClient ¶
type RepoClient interface { GetUser(login string) (*github.User, error) GetRepoLabels(org, repo string) ([]*github.Label, error) GetIssues(org, repo string, options *github.IssueListByRepoOptions) ([]*github.Issue, error) CreateIssue(org, repo, title, body string, labels, owners []string) (*github.Issue, error) GetCollaborators(org, repo string) ([]*github.User, error) }
RepoClient is the interface IssueCreator used to interact with github. This interface is necessary for testing the IssueCreator with dependency injection.