repoowners

package
v0.0.899 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the repoowners client

func NewClient

func NewClient(
	gc git2.Client,
	spc scmProviderClient,
	config *prowConf.Config,
	mdYAMLEnabled func(org, repo string) bool,
	skipCollaborators func(org, repo string) bool,
) *Client

NewClient is the constructor for Client

func (*Client) LoadRepoAliases

func (c *Client) LoadRepoAliases(org, repo, base string) (RepoAliases, error)

LoadRepoAliases returns an up-to-date RepoAliases struct for the specified repo. If the repo does not have an aliases file then an empty alias map is returned with no error. Note: The returned RepoAliases should be treated as read only.

func (*Client) LoadRepoOwners

func (c *Client) LoadRepoOwners(org, repo, base string) (RepoOwner, error)

LoadRepoOwners returns an up-to-date RepoOwners struct for the specified repo. Note: The returned *RepoOwners should be treated as read only.

type Config

type Config struct {
	Approvers         []string `json:"approvers,omitempty"`
	Reviewers         []string `json:"reviewers,omitempty"`
	RequiredReviewers []string `json:"required_reviewers,omitempty"`
	Labels            []string `json:"labels,omitempty"`
}

Config holds roles+usernames and labels for a directory considered as a unit of independent code

type FullConfig

type FullConfig struct {
	Options dirOptions        `json:"options,omitempty"`
	Filters map[string]Config `json:"filters,omitempty"`
}

FullConfig contains Filters which apply specific Config to files matching its regexp

func ParseFullConfig

func ParseFullConfig(b []byte) (FullConfig, error)

ParseFullConfig will unmarshal OWNERS file's content into a FullConfig Returns an error if the content cannot be unmarshalled

type Interface

type Interface interface {
	LoadRepoAliases(org, repo, base string) (RepoAliases, error)
	LoadRepoOwners(org, repo, base string) (RepoOwner, error)
}

Interface is an interface to work with OWNERS files.

type RepoAliases

type RepoAliases map[string]sets.String

RepoAliases defines groups of people to be used in OWNERS files

func (RepoAliases) ExpandAlias

func (a RepoAliases) ExpandAlias(alias string) sets.String

ExpandAlias returns members of an alias

func (RepoAliases) ExpandAliases

func (a RepoAliases) ExpandAliases(logins sets.String) sets.String

ExpandAliases returns members of multiple aliases, duplicates are pruned

type RepoOwner

type RepoOwner interface {
	FindApproverOwnersForFile(path string) string
	FindReviewersOwnersForFile(path string) string
	FindLabelsForFile(path string) sets.String
	IsNoParentOwners(path string) bool
	LeafApprovers(path string) sets.String
	Approvers(path string) sets.String
	LeafReviewers(path string) sets.String
	Reviewers(path string) sets.String
	RequiredReviewers(path string) sets.String
}

RepoOwner is an interface to work with repoowners

type RepoOwners

type RepoOwners struct {
	RepoAliases
	// contains filtered or unexported fields
}

RepoOwners contains the parsed OWNERS config.

func (*RepoOwners) Approvers

func (o *RepoOwners) Approvers(path string) sets.String

Approvers returns ALL of the users who are approvers for the requested file (including approvers in parent dirs' OWNERS). If pkg/OWNERS has user1 and pkg/util/OWNERS has user2 this will return both user1 and user2 for the path pkg/util/sets/file.go

func (*RepoOwners) FindApproverOwnersForFile

func (o *RepoOwners) FindApproverOwnersForFile(path string) string

FindApproverOwnersForFile returns the OWNERS file path furthest down the tree for a specified file that contains an approvers section

func (*RepoOwners) FindLabelsForFile

func (o *RepoOwners) FindLabelsForFile(path string) sets.String

FindLabelsForFile returns a set of labels which should be applied to PRs modifying files under the given path.

func (*RepoOwners) FindReviewersOwnersForFile

func (o *RepoOwners) FindReviewersOwnersForFile(path string) string

FindReviewersOwnersForFile returns the OWNERS file path furthest down the tree for a specified file that contains a reviewers section

func (*RepoOwners) IsNoParentOwners

func (o *RepoOwners) IsNoParentOwners(path string) bool

IsNoParentOwners checks if an OWNERS file path refers to an OWNERS file with NoParentOwners enabled.

func (*RepoOwners) LeafApprovers

func (o *RepoOwners) LeafApprovers(path string) sets.String

LeafApprovers returns a set of users who are the closest approvers to the requested file. If pkg/OWNERS has user1 and pkg/util/OWNERS has user2 this will only return user2 for the path pkg/util/sets/file.go

func (*RepoOwners) LeafReviewers

func (o *RepoOwners) LeafReviewers(path string) sets.String

LeafReviewers returns a set of users who are the closest reviewers to the requested file. If pkg/OWNERS has user1 and pkg/util/OWNERS has user2 this will only return user2 for the path pkg/util/sets/file.go

func (*RepoOwners) RequiredReviewers

func (o *RepoOwners) RequiredReviewers(path string) sets.String

RequiredReviewers returns ALL of the users who are required_reviewers for the requested file (including required_reviewers in parent dirs' OWNERS). If pkg/OWNERS has user1 and pkg/util/OWNERS has user2 this will return both user1 and user2 for the path pkg/util/sets/file.go

func (*RepoOwners) Reviewers

func (o *RepoOwners) Reviewers(path string) sets.String

Reviewers returns ALL of the users who are reviewers for the requested file (including reviewers in parent dirs' OWNERS). If pkg/OWNERS has user1 and pkg/util/OWNERS has user2 this will return both user1 and user2 for the path pkg/util/sets/file.go

type SimpleConfig

type SimpleConfig struct {
	Options dirOptions `json:"options,omitempty"`
	Config  `json:",inline"`
}

SimpleConfig holds options and Config applied to everything under the containing directory

func ParseSimpleConfig

func ParseSimpleConfig(b []byte) (SimpleConfig, error)

ParseSimpleConfig will unmarshal an OWNERS file's content into a SimpleConfig Returns an error if the content cannot be unmarshalled

func (*SimpleConfig) Empty

func (s *SimpleConfig) Empty() bool

Empty checks if a SimpleConfig could be considered empty

Jump to

Keyboard shortcuts

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