features

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// BranchProtectionFeature should update the branches with the required contexts
	BranchProtectionFeature = "branch-protection"
)
View Source
const (

	// RepoFeatureName is how mungers should indicate this is required
	RepoFeatureName = "gitrepos"
)
View Source
const (
	ServerFeatureName = "server"
)

Variables

This section is empty.

Functions

func RegisterFeature

func RegisterFeature(feat feature) error

RegisterFeature should be called in `init()` by each feature to make itself available by name

Types

type BranchProtection

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

BranchProtection is a features that sets branches as protected

func (*BranchProtection) EachLoop

func (bp *BranchProtection) EachLoop() error

EachLoop is called at the start of every munge loop

func (*BranchProtection) Initialize

func (bp *BranchProtection) Initialize(config *github.Config) error

Initialize will initialize the feature.

func (*BranchProtection) Name

func (bp *BranchProtection) Name() string

Name is just going to return the name mungers use to request this feature

func (*BranchProtection) RegisterOptions

func (bp *BranchProtection) RegisterOptions(opts *options.Options) sets.String

RegisterOptions registers options for this feature; returns any that require a restart when changed.

type Features

type Features struct {
	Repos  *RepoInfo
	Server *ServerFeature
	// contains filtered or unexported fields
}

Features are all features the code know about. Care should be taken not to try to use a feature which isn't 'active'

func (*Features) EachLoop

func (f *Features) EachLoop() error

EachLoop allows active features to update every loop

func (*Features) GetActive

func (f *Features) GetActive() []feature

GetActive returns all features requested by a munger

func (*Features) Initialize

func (f *Features) Initialize(config *github.Config, requestedFeatures []string) error

Initialize should be called with the set of all features needed by all (active) mungers

func (*Features) RegisterOptions

func (f *Features) RegisterOptions(opts *options.Options) sets.String

RegisterOptions registers the options used by features and returns any options that should trigger a restart when they are changed.

type RepoInfo

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

RepoInfo provides information about users in OWNERS files in a git repo

func (*RepoInfo) AllPossibleOwnerLabels

func (o *RepoInfo) AllPossibleOwnerLabels() sets.String

AllPossibleOwnerLabels returns all labels found in any owners files

func (*RepoInfo) Approvers

func (o *RepoInfo) 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 (*RepoInfo) EachLoop

func (o *RepoInfo) EachLoop() error

EachLoop is called at the start of every munge loop

func (*RepoInfo) FindApproverOwnersForPath

func (o *RepoInfo) FindApproverOwnersForPath(path string) string

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

func (*RepoInfo) FindLabelsForPath

func (o *RepoInfo) FindLabelsForPath(path string) sets.String

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

func (*RepoInfo) FindReviewersForPath

func (o *RepoInfo) FindReviewersForPath(path string) string

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

func (*RepoInfo) GitCommand

func (o *RepoInfo) GitCommand(args []string) ([]byte, error)

GitCommand will execute the git command with the `args` within the project directory.

func (*RepoInfo) Initialize

func (o *RepoInfo) Initialize(config *github.Config) error

Initialize will initialize the munger

func (*RepoInfo) LeafApprovers

func (o *RepoInfo) 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 (*RepoInfo) LeafReviewers

func (o *RepoInfo) 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 (*RepoInfo) Name

func (o *RepoInfo) Name() string

Name is just going to return the name mungers use to request this feature

func (*RepoInfo) RegisterOptions

func (o *RepoInfo) RegisterOptions(opts *options.Options) sets.String

RegisterOptions registers options for this feature; returns any that require a restart when changed.

func (*RepoInfo) Reviewers

func (o *RepoInfo) 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 ServerFeature

type ServerFeature struct {
	*sharedmux.ConcurrentMux
	Enabled bool

	Address string
	WWWRoot string
	// contains filtered or unexported fields
}

ServerFeature runs a server and allows mungers to register handlers for paths, or prometheus metrics.

func (*ServerFeature) EachLoop

func (s *ServerFeature) EachLoop() error

EachLoop is called at the start of every munge loop

func (*ServerFeature) Initialize

func (s *ServerFeature) Initialize(config *github.Config) error

Initialize will initialize the feature.

func (*ServerFeature) Name

func (s *ServerFeature) Name() string

Name is just going to return the name mungers use to request this feature

func (*ServerFeature) RegisterOptions

func (s *ServerFeature) RegisterOptions(opts *options.Options) sets.String

RegisterOptions registers options for this feature; returns any that require a restart when changed.

Jump to

Keyboard shortcuts

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