Documentation ¶
Overview ¶
Package pulls deals with munging of github pull requests
Index ¶
- func EachLoop(config *github_util.Config) error
- func InitializeMungers(requestedMungers []string, config *github_util.Config) error
- func MungePullRequests(config *github_util.Config) error
- func RegisterMunger(munger PRMunger) error
- func RegisterMungerOrDie(munger PRMunger)
- type BlunderbussConfig
- type BlunderbussMunger
- func (b *BlunderbussMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (b *BlunderbussMunger) EachLoop(_ *github_util.Config) error
- func (b *BlunderbussMunger) Initialize(config *github_util.Config) error
- func (b *BlunderbussMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (b *BlunderbussMunger) Name() string
- type LGTMAfterCommitMunger
- func (LGTMAfterCommitMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (LGTMAfterCommitMunger) EachLoop(_ *github_util.Config) error
- func (LGTMAfterCommitMunger) Initialize(config *github_util.Config) error
- func (LGTMAfterCommitMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (LGTMAfterCommitMunger) Name() string
- type NeedsRebaseMunger
- func (NeedsRebaseMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (NeedsRebaseMunger) EachLoop(_ *github_util.Config) error
- func (NeedsRebaseMunger) Initialize(config *github_util.Config) error
- func (NeedsRebaseMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (NeedsRebaseMunger) Name() string
- type OkToTestMunger
- func (OkToTestMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (OkToTestMunger) EachLoop(_ *github_util.Config) error
- func (OkToTestMunger) Initialize(config *github_util.Config) error
- func (OkToTestMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (OkToTestMunger) Name() string
- type PRMunger
- type PathLabelMunger
- func (p *PathLabelMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (p *PathLabelMunger) EachLoop(_ *github_util.Config) error
- func (p *PathLabelMunger) Initialize(config *github_util.Config) error
- func (p *PathLabelMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (p *PathLabelMunger) Name() string
- type PingCIMunger
- func (PingCIMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (PingCIMunger) EachLoop(_ *github_util.Config) error
- func (PingCIMunger) Initialize(config *github_util.Config) error
- func (PingCIMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (PingCIMunger) Name() string
- type SizeMunger
- func (s *SizeMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (SizeMunger) EachLoop(_ *github_util.Config) error
- func (SizeMunger) Initialize(config *github_util.Config) error
- func (s *SizeMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, ...)
- func (SizeMunger) Name() string
- type SubmitQueue
- func (sq *SubmitQueue) AddFlags(cmd *cobra.Command, config *github_util.Config)
- func (sq *SubmitQueue) EachLoop(config *github_util.Config) error
- func (sq *SubmitQueue) GetQueueStatus() []byte
- func (sq *SubmitQueue) Initialize(config *github_util.Config) error
- func (sq *SubmitQueue) MungePullRequest(config *github_util.Config, pr *github_api.PullRequest, ...)
- func (sq SubmitQueue) Name() string
- func (sq *SubmitQueue) RefreshWhitelist(config *github_util.Config)
- func (sq *SubmitQueue) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (sq *SubmitQueue) SetPRStatus(pr *github_api.PullRequest, reason string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EachLoop ¶
func EachLoop(config *github_util.Config) error
EachLoop will be called before we start a poll loop and will run the EachLoop function for all active mungers
func InitializeMungers ¶
func InitializeMungers(requestedMungers []string, config *github_util.Config) error
InitializeMungers will call munger.Initialize() for all mungers requested in --pr-mungers
func MungePullRequests ¶
func MungePullRequests(config *github_util.Config) error
MungePullRequests is the main function which asks that each munger be called for each PR
func RegisterMunger ¶
RegisterMunger should be called in `init()` by each munger to make itself available by name
func RegisterMungerOrDie ¶
func RegisterMungerOrDie(munger PRMunger)
RegisterMungerOrDie will call RegisterMunger but will be fatal on error
Types ¶
type BlunderbussConfig ¶
type BlunderbussConfig struct {
PrefixMap map[string][]string `json:"prefixMap,omitempty" yaml:"prefixMap,omitempty"`
}
A BlunderbussConfig maps a set of file prefixes to a set of owner names (github users)
type BlunderbussMunger ¶
type BlunderbussMunger struct {
// contains filtered or unexported fields
}
BlunderbussMunger will assign issues to users based on the config file provided by --blunderbuss-config.
func (*BlunderbussMunger) AddFlags ¶
func (b *BlunderbussMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*BlunderbussMunger) EachLoop ¶
func (b *BlunderbussMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (*BlunderbussMunger) Initialize ¶
func (b *BlunderbussMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (*BlunderbussMunger) MungePullRequest ¶
func (b *BlunderbussMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (*BlunderbussMunger) Name ¶
func (b *BlunderbussMunger) Name() string
Name is the name usable in --pr-mungers
type LGTMAfterCommitMunger ¶
type LGTMAfterCommitMunger struct{}
LGTMAfterCommitMunger will remove the LGTM flag from an PR which has been updated since the reviewer added LGTM
func (LGTMAfterCommitMunger) AddFlags ¶
func (LGTMAfterCommitMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (LGTMAfterCommitMunger) EachLoop ¶
func (LGTMAfterCommitMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (LGTMAfterCommitMunger) Initialize ¶
func (LGTMAfterCommitMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (LGTMAfterCommitMunger) MungePullRequest ¶
func (LGTMAfterCommitMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (LGTMAfterCommitMunger) Name ¶
func (LGTMAfterCommitMunger) Name() string
Name is the name usable in --pr-mungers
type NeedsRebaseMunger ¶
type NeedsRebaseMunger struct{}
NeedsRebaseMunger will add the "needs-rebase" label to any issue which is unable to be automatically merged
func (NeedsRebaseMunger) AddFlags ¶
func (NeedsRebaseMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (NeedsRebaseMunger) EachLoop ¶
func (NeedsRebaseMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (NeedsRebaseMunger) Initialize ¶
func (NeedsRebaseMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (NeedsRebaseMunger) MungePullRequest ¶
func (NeedsRebaseMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (NeedsRebaseMunger) Name ¶
func (NeedsRebaseMunger) Name() string
Name is the name usable in --pr-mungers
type OkToTestMunger ¶
type OkToTestMunger struct{}
OkToTestMunger looks for situations where a reviewer has LGTM'd a PR, but it isn't ok to test by the k8s-bot, and adds an 'ok to test' comment to the PR.
func (OkToTestMunger) AddFlags ¶
func (OkToTestMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (OkToTestMunger) EachLoop ¶
func (OkToTestMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (OkToTestMunger) Initialize ¶
func (OkToTestMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (OkToTestMunger) MungePullRequest ¶
func (OkToTestMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (OkToTestMunger) Name ¶
func (OkToTestMunger) Name() string
Name is the name usable in --pr-mungers
type PRMunger ¶
type PRMunger interface { // Take action on a specific pull request includes: // * The config for mungers // * The PR object // * The issue object for the PR, github stores some things (e.g. labels) in an "issue" object with the same number as the PR // * The commits for the PR // * The events on the PR MungePullRequest(config *github_util.Config, pr *github_api.PullRequest, issue *github_api.Issue, commits []github_api.RepositoryCommit, events []github_api.IssueEvent) AddFlags(cmd *cobra.Command, config *github_util.Config) Name() string Initialize(*github_util.Config) error EachLoop(*github_util.Config) error }
PRMunger is the interface which all mungers must implement to register
func GetAllMungers ¶
func GetAllMungers() []PRMunger
GetAllMungers returns a slice of all registered mungers. This list is completely independant of the mungers selected at runtime in --pr-mungers. This is all possible mungers.
type PathLabelMunger ¶
type PathLabelMunger struct {
// contains filtered or unexported fields
}
PathLabelMunger will add labels to PRs based on what files it modified. The mapping of files to labels if provided in a file in --path-label-config
func (*PathLabelMunger) AddFlags ¶
func (p *PathLabelMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*PathLabelMunger) EachLoop ¶
func (p *PathLabelMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (*PathLabelMunger) Initialize ¶
func (p *PathLabelMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (*PathLabelMunger) MungePullRequest ¶
func (p *PathLabelMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (*PathLabelMunger) Name ¶
func (p *PathLabelMunger) Name() string
Name is the name usable in --pr-mungers
type PingCIMunger ¶
type PingCIMunger struct{}
PingCIMunger looks for situations CI (Travis | Shippable) has flaked for some reason and we want to re-run them. Achieves this by closing and re-opening the pr
func (PingCIMunger) AddFlags ¶
func (PingCIMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (PingCIMunger) EachLoop ¶
func (PingCIMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (PingCIMunger) Initialize ¶
func (PingCIMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (PingCIMunger) MungePullRequest ¶
func (PingCIMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (PingCIMunger) Name ¶
func (PingCIMunger) Name() string
Name is the name usable in --pr-mungers
type SizeMunger ¶
type SizeMunger struct {
// contains filtered or unexported fields
}
SizeMunger will update a label on a PR based on how many lines are changed. It will exclude certain files in it's calculations based on the config file provided in --generated-files-config
func (*SizeMunger) AddFlags ¶
func (s *SizeMunger) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (SizeMunger) EachLoop ¶
func (SizeMunger) EachLoop(_ *github_util.Config) error
EachLoop is called at the start of every munge loop
func (SizeMunger) Initialize ¶
func (SizeMunger) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (*SizeMunger) MungePullRequest ¶
func (s *SizeMunger) MungePullRequest(config *github_util.Config, pr *github.PullRequest, issue *github.Issue, commits []github.RepositoryCommit, events []github.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
type SubmitQueue ¶
type SubmitQueue struct { JenkinsJobs []string JenkinsHost string Whitelist string RequiredStatusContexts []string WhitelistOverride string Committers string Address string DontRequireE2ELabel string E2EStatusContext string WWWRoot string sync.Mutex // contains filtered or unexported fields }
SubmitQueue will merge PR which meet a set of requirements.
PR must have LGTM after the last commit PR must have passed all github CI checks if user not in whitelist PR must have "ok-to-merge" The google internal jenkins instance must be passing the JenkinsJobs e2e tests
func (*SubmitQueue) AddFlags ¶
func (sq *SubmitQueue) AddFlags(cmd *cobra.Command, config *github_util.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*SubmitQueue) EachLoop ¶
func (sq *SubmitQueue) EachLoop(config *github_util.Config) error
EachLoop is called at the start of every munge loop
func (*SubmitQueue) GetQueueStatus ¶
func (sq *SubmitQueue) GetQueueStatus() []byte
GetQueueStatus returns a json representation of the state of the submit queue. This can be used to generate web pages about the submit queue.
func (*SubmitQueue) Initialize ¶
func (sq *SubmitQueue) Initialize(config *github_util.Config) error
Initialize will initialize the munger
func (*SubmitQueue) MungePullRequest ¶
func (sq *SubmitQueue) MungePullRequest(config *github_util.Config, pr *github_api.PullRequest, issue *github_api.Issue, commits []github_api.RepositoryCommit, events []github_api.IssueEvent)
MungePullRequest is the workhorse the will actually make updates to the PR
func (SubmitQueue) Name ¶
func (sq SubmitQueue) Name() string
Name is the name usable in --pr-mungers
func (*SubmitQueue) RefreshWhitelist ¶
func (sq *SubmitQueue) RefreshWhitelist(config *github_util.Config)
RefreshWhitelist updates the whitelist, re-getting the list of committers.
func (*SubmitQueue) ServeHTTP ¶
func (sq *SubmitQueue) ServeHTTP(res http.ResponseWriter, req *http.Request)
func (*SubmitQueue) SetPRStatus ¶
func (sq *SubmitQueue) SetPRStatus(pr *github_api.PullRequest, reason string)
SetPRStatus will set the status given a particular PR. This function should but used instead of manipulating the prStatus directly as sq.Lock() must be called when manipulating that structure