Documentation ¶
Overview ¶
Package mungers deals with munging of github pull requests
Index ¶
- func EachLoop() error
- func InitializeMungers(requestedMungers []string, config *github.Config, features *features.Features) error
- func MungeIssue(obj *github.MungeObject) error
- func RegisterMunger(munger Munger) error
- func RegisterMungerOrDie(munger Munger)
- func RequestedFeatures() []string
- type BlockPath
- func (b *BlockPath) AddFlags(cmd *cobra.Command, config *github.Config)
- func (b *BlockPath) EachLoop() error
- func (b *BlockPath) Initialize(config *github.Config, features *features.Features) error
- func (b *BlockPath) Munge(obj *github.MungeObject)
- func (b *BlockPath) Name() string
- func (b *BlockPath) RequiredFeatures() []string
- type BlunderbussConfig
- type BlunderbussMunger
- func (b *BlunderbussMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (b *BlunderbussMunger) EachLoop() error
- func (b *BlunderbussMunger) Initialize(config *github.Config, features *features.Features) error
- func (b *BlunderbussMunger) Munge(obj *github.MungeObject)
- func (b *BlunderbussMunger) Name() string
- func (b *BlunderbussMunger) RequiredFeatures() []string
- type LGTMAfterCommitMunger
- func (LGTMAfterCommitMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (LGTMAfterCommitMunger) EachLoop() error
- func (LGTMAfterCommitMunger) Initialize(config *github.Config, features *features.Features) error
- func (LGTMAfterCommitMunger) Munge(obj *github.MungeObject)
- func (LGTMAfterCommitMunger) Name() string
- func (LGTMAfterCommitMunger) RequiredFeatures() []string
- type Munger
- type NeedsRebaseMunger
- func (NeedsRebaseMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (NeedsRebaseMunger) EachLoop() error
- func (NeedsRebaseMunger) Initialize(config *github.Config, features *features.Features) error
- func (NeedsRebaseMunger) Munge(obj *github.MungeObject)
- func (NeedsRebaseMunger) Name() string
- func (NeedsRebaseMunger) RequiredFeatures() []string
- type OkToTestMunger
- func (OkToTestMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (OkToTestMunger) EachLoop() error
- func (OkToTestMunger) Initialize(config *github.Config, features *features.Features) error
- func (OkToTestMunger) Munge(obj *github.MungeObject)
- func (OkToTestMunger) Name() string
- func (OkToTestMunger) RequiredFeatures() []string
- type PathLabelMunger
- func (p *PathLabelMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (p *PathLabelMunger) EachLoop() error
- func (p *PathLabelMunger) Initialize(config *github.Config, features *features.Features) error
- func (p *PathLabelMunger) Munge(obj *github.MungeObject)
- func (p *PathLabelMunger) Name() string
- func (p *PathLabelMunger) RequiredFeatures() []string
- type PingCIMunger
- func (PingCIMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (PingCIMunger) EachLoop() error
- func (PingCIMunger) Initialize(config *github.Config, features *features.Features) error
- func (PingCIMunger) Munge(obj *github.MungeObject)
- func (PingCIMunger) Name() string
- func (PingCIMunger) RequiredFeatures() []string
- type RebuildMunger
- func (r *RebuildMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (r *RebuildMunger) EachLoop() error
- func (r *RebuildMunger) Initialize(config *github.Config, features *features.Features) error
- func (r *RebuildMunger) Munge(obj *github.MungeObject)
- func (r *RebuildMunger) Name() string
- func (r *RebuildMunger) RequiredFeatures() []string
- type SizeMunger
- func (s *SizeMunger) AddFlags(cmd *cobra.Command, config *github.Config)
- func (SizeMunger) EachLoop() error
- func (SizeMunger) Initialize(config *github.Config, features *features.Features) error
- func (s *SizeMunger) Munge(obj *github.MungeObject)
- func (SizeMunger) Name() string
- func (SizeMunger) RequiredFeatures() []string
- type StaleGreenCI
- func (StaleGreenCI) AddFlags(cmd *cobra.Command, config *github.Config)
- func (StaleGreenCI) EachLoop() error
- func (StaleGreenCI) Initialize(config *github.Config, features *features.Features) error
- func (StaleGreenCI) Munge(obj *github.MungeObject)
- func (StaleGreenCI) Name() string
- func (StaleGreenCI) RequiredFeatures() []string
- type StalePendingCI
- func (StalePendingCI) AddFlags(cmd *cobra.Command, config *github.Config)
- func (StalePendingCI) EachLoop() error
- func (StalePendingCI) Initialize(config *github.Config, features *features.Features) error
- func (StalePendingCI) Munge(obj *github.MungeObject)
- func (StalePendingCI) Name() string
- func (StalePendingCI) RequiredFeatures() []string
- type SubmitQueue
- func (sq *SubmitQueue) AddFlags(cmd *cobra.Command, config *github.Config)
- func (sq *SubmitQueue) EachLoop() error
- func (sq *SubmitQueue) Initialize(config *github.Config, features *features.Features) error
- func (sq *SubmitQueue) Munge(obj *github.MungeObject)
- func (sq SubmitQueue) Name() string
- func (sq *SubmitQueue) RefreshWhitelist()
- func (sq SubmitQueue) RequiredFeatures() []string
- func (sq *SubmitQueue) SetMergeStatus(obj *github.MungeObject, reason string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EachLoop ¶
func EachLoop() 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.Config, features *features.Features) error
InitializeMungers will call munger.Initialize() for all mungers requested in --pr-mungers
func MungeIssue ¶
func MungeIssue(obj *github.MungeObject) error
MungeIssue will call each activated munger with the given object
func RegisterMunger ¶
RegisterMunger should be called in `init()` by each munger to make itself available by name
func RegisterMungerOrDie ¶
func RegisterMungerOrDie(munger Munger)
RegisterMungerOrDie will call RegisterMunger but will be fatal on error
func RequestedFeatures ¶
func RequestedFeatures() []string
RequestedFeatures returns a list of all feature which should be enabled for the running mungers
Types ¶
type BlockPath ¶
type BlockPath struct {
// contains filtered or unexported fields
}
BlockPath will add a label to block auto merge if a PR touches certain paths
func (*BlockPath) Initialize ¶
Initialize will initialize the munger
func (*BlockPath) Munge ¶
func (b *BlockPath) Munge(obj *github.MungeObject)
Munge is the workhorse the will actually make updates to the PR
func (*BlockPath) RequiredFeatures ¶
RequiredFeatures is a slice of 'features' that must be provided
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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*BlunderbussMunger) EachLoop ¶
func (b *BlunderbussMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (*BlunderbussMunger) Initialize ¶
Initialize will initialize the munger
func (*BlunderbussMunger) Munge ¶
func (b *BlunderbussMunger) Munge(obj *github.MungeObject)
Munge 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
func (*BlunderbussMunger) RequiredFeatures ¶
func (b *BlunderbussMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (LGTMAfterCommitMunger) EachLoop ¶
func (LGTMAfterCommitMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (LGTMAfterCommitMunger) Initialize ¶
Initialize will initialize the munger
func (LGTMAfterCommitMunger) Munge ¶
func (LGTMAfterCommitMunger) Munge(obj *github.MungeObject)
Munge 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
func (LGTMAfterCommitMunger) RequiredFeatures ¶
func (LGTMAfterCommitMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
type Munger ¶
type Munger interface { // Take action on a specific github issue: Munge(obj *github.MungeObject) AddFlags(cmd *cobra.Command, config *github.Config) Name() string RequiredFeatures() []string Initialize(*github.Config, *features.Features) error EachLoop() error }
Munger is the interface which all mungers must implement to register
func GetActiveMungers ¶
func GetActiveMungers() []Munger
GetActiveMungers returns a slice of all mungers which both registered and were requested by the user
func GetAllMungers ¶
func GetAllMungers() []Munger
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 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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (NeedsRebaseMunger) EachLoop ¶
func (NeedsRebaseMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (NeedsRebaseMunger) Initialize ¶
Initialize will initialize the munger
func (NeedsRebaseMunger) Munge ¶
func (NeedsRebaseMunger) Munge(obj *github.MungeObject)
Munge 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
func (NeedsRebaseMunger) RequiredFeatures ¶
func (NeedsRebaseMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (OkToTestMunger) EachLoop ¶
func (OkToTestMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (OkToTestMunger) Initialize ¶
Initialize will initialize the munger
func (OkToTestMunger) Munge ¶
func (OkToTestMunger) Munge(obj *github.MungeObject)
Munge 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
func (OkToTestMunger) RequiredFeatures ¶
func (OkToTestMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*PathLabelMunger) EachLoop ¶
func (p *PathLabelMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (*PathLabelMunger) Initialize ¶
Initialize will initialize the munger
func (*PathLabelMunger) Munge ¶
func (p *PathLabelMunger) Munge(obj *github.MungeObject)
Munge 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
func (*PathLabelMunger) RequiredFeatures ¶
func (p *PathLabelMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (PingCIMunger) EachLoop ¶
func (PingCIMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (PingCIMunger) Initialize ¶
Initialize will initialize the munger
func (PingCIMunger) Munge ¶
func (PingCIMunger) Munge(obj *github.MungeObject)
Munge 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
func (PingCIMunger) RequiredFeatures ¶
func (PingCIMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
type RebuildMunger ¶
type RebuildMunger struct {
// contains filtered or unexported fields
}
RebuildMunger looks for situations where a someone has asked for an e2e rebuild, but hasn't provided an issue
func (*RebuildMunger) AddFlags ¶
func (r *RebuildMunger) AddFlags(cmd *cobra.Command, config *github.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*RebuildMunger) EachLoop ¶
func (r *RebuildMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (*RebuildMunger) Initialize ¶
Initialize will initialize the munger
func (*RebuildMunger) Munge ¶
func (r *RebuildMunger) Munge(obj *github.MungeObject)
Munge is the workhorse the will actually make updates to the PR
func (*RebuildMunger) Name ¶
func (r *RebuildMunger) Name() string
Name is the name usable in --pr-mungers
func (*RebuildMunger) RequiredFeatures ¶
func (r *RebuildMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (SizeMunger) EachLoop ¶
func (SizeMunger) EachLoop() error
EachLoop is called at the start of every munge loop
func (SizeMunger) Initialize ¶
Initialize will initialize the munger
func (*SizeMunger) Munge ¶
func (s *SizeMunger) Munge(obj *github.MungeObject)
Munge is the workhorse the will actually make updates to the PR
func (SizeMunger) RequiredFeatures ¶
func (SizeMunger) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
type StaleGreenCI ¶
type StaleGreenCI struct{}
StaleGreenCI will remove the LGTM flag from an PR which has been updated since the reviewer added LGTM
func (StaleGreenCI) AddFlags ¶
func (StaleGreenCI) AddFlags(cmd *cobra.Command, config *github.Config)
AddFlags will add any request flags to the cobra `cmd`
func (StaleGreenCI) EachLoop ¶
func (StaleGreenCI) EachLoop() error
EachLoop is called at the start of every munge loop
func (StaleGreenCI) Initialize ¶
Initialize will initialize the munger
func (StaleGreenCI) Munge ¶
func (StaleGreenCI) Munge(obj *github.MungeObject)
Munge is the workhorse the will actually make updates to the PR
func (StaleGreenCI) Name ¶
func (StaleGreenCI) Name() string
Name is the name usable in --pr-mungers
func (StaleGreenCI) RequiredFeatures ¶
func (StaleGreenCI) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
type StalePendingCI ¶
type StalePendingCI struct{}
StalePendingCI will ask the k8s-bot to test any PR with a LGTM that has been pending for more than 24 hours. This can happen when the jenkins VM is restarted.
The real fix would be for the jenkins VM restart to not move every single PR to pending without actually testing...
But this is our world and so we should really do this for all PRs which aren't likely to get another push (everything that is mergeable). Since that can be a lot of PRs, I'm just doing it for the LGTM PRs automatically...
With minor modification this can be run easily by hand. Remove the LGTM check godep go build ./mungegithub --token-file=/PATH/TO/YOUR/TOKEN --pr-mungers=stale-pending-ci --once (--dry-run)
func (StalePendingCI) AddFlags ¶
func (StalePendingCI) AddFlags(cmd *cobra.Command, config *github.Config)
AddFlags will add any request flags to the cobra `cmd`
func (StalePendingCI) EachLoop ¶
func (StalePendingCI) EachLoop() error
EachLoop is called at the start of every munge loop
func (StalePendingCI) Initialize ¶
Initialize will initialize the munger
func (StalePendingCI) Munge ¶
func (StalePendingCI) Munge(obj *github.MungeObject)
Munge is the workhorse the will actually make updates to the PR
func (StalePendingCI) Name ¶
func (StalePendingCI) Name() string
Name is the name usable in --pr-mungers
func (StalePendingCI) RequiredFeatures ¶
func (StalePendingCI) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
type SubmitQueue ¶
type SubmitQueue struct { JenkinsJobs []string JenkinsHost string Whitelist string WhitelistOverride string Committers string Address string E2EStatusContext string UnitStatusContext string RequiredStatusContexts []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.Config)
AddFlags will add any request flags to the cobra `cmd`
func (*SubmitQueue) EachLoop ¶
func (sq *SubmitQueue) EachLoop() error
EachLoop is called at the start of every munge loop
func (*SubmitQueue) Initialize ¶
Initialize will initialize the munger
func (*SubmitQueue) Munge ¶
func (sq *SubmitQueue) Munge(obj *github.MungeObject)
Munge 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()
RefreshWhitelist updates the whitelist, re-getting the list of committers. called with sq.Lock() held!
func (SubmitQueue) RequiredFeatures ¶
func (sq SubmitQueue) RequiredFeatures() []string
RequiredFeatures is a slice of 'features' that must be provided
func (*SubmitQueue) SetMergeStatus ¶
func (sq *SubmitQueue) SetMergeStatus(obj *github.MungeObject, reason string)
SetMergeStatus will set the status given a particular PR. This function should be used instead of manipulating the prStatus directly as sq.Lock() must be called when manipulating that structure `obj` is the active github object `reason` is the new 'status' for this object