plugins

package
v0.0.0-...-71304e1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AboutThisBotCommands = "I understand the commands that are listed [here](https://github.com/kubernetes/test-infra/blob/master/commands.md)."
View Source
const AboutThisBotWithoutCommands = "" /* 369-byte string literal not displayed */

Variables

This section is empty.

Functions

func FormatICResponse

func FormatICResponse(ic github.IssueComment, s string) string

FormatICResponse nicely formats a response to an issue comment.

func FormatResponse

func FormatResponse(to, message, reason string) string

FormatResponse nicely formats a response to a generic reason.

func FormatResponseRaw

func FormatResponseRaw(body, bodyURL, login, reply string) string

FormatResponseRaw nicely formats a response for one does not have an issue comment

func RegisterGenericCommentHandler

func RegisterGenericCommentHandler(name string, fn GenericCommentHandler)

func RegisterIssueCommentHandler

func RegisterIssueCommentHandler(name string, fn IssueCommentHandler)

func RegisterIssueHandler

func RegisterIssueHandler(name string, fn IssueHandler)

func RegisterPullRequestHandler

func RegisterPullRequestHandler(name string, fn PullRequestHandler)

func RegisterPushEventHandler

func RegisterPushEventHandler(name string, fn PushEventHandler)

func RegisterReviewCommentEventHandler

func RegisterReviewCommentEventHandler(name string, fn ReviewCommentEventHandler)

func RegisterReviewEventHandler

func RegisterReviewEventHandler(name string, fn ReviewEventHandler)

func RegisterStatusEventHandler

func RegisterStatusEventHandler(name string, fn StatusEventHandler)

Types

type ConfigUpdater

type ConfigUpdater struct {
	// The location of the prow configuration file inside the repository
	// where the config-updater plugin is enabled. This needs to be relative
	// to the root of the repository, eg. "prow/config.yaml" will match
	// github.com/kubernetes/test-infra/prow/config.yaml assuming the config-updater
	// plugin is enabled for kubernetes/test-infra. Defaults to "prow/config.yaml".
	ConfigFile string `json:"config_file,omitempty"`
	// The location of the prow plugin configuration file inside the repository
	// where the config-updater plugin is enabled. This needs to be relative
	// to the root of the repository, eg. "prow/plugins.yaml" will match
	// github.com/kubernetes/test-infra/prow/plugins.yaml assuming the config-updater
	// plugin is enabled for kubernetes/test-infra. Defaults to "prow/plugins.yaml".
	PluginFile string `json:"plugin_file,omitempty"`
}

type Configuration

type Configuration struct {
	// Repo (eg "k/k") -> list of handler names.
	Plugins  map[string][]string `json:"plugins,omitempty"`
	Triggers []Trigger           `json:"triggers,omitempty"`
	Heart    Heart               `json:"heart,omitempty"`
	Label    Label               `json:"label,omitempty"`
	Slack    Slack               `json:"slack,omitempty"`
	// ConfigUpdater holds config for the config-updater plugin.
	ConfigUpdater ConfigUpdater `json:"config_updater,omitempty"`
}

Configuration is the top-level serialization target for plugin Configuration

func (*Configuration) TriggerFor

func (c *Configuration) TriggerFor(org, repo string) *Trigger

TriggerFor finds the Trigger for a repo, if one exists a trigger can be listed for the repo itself or for the owning organization

type GenericCommentHandler

type GenericCommentHandler func(PluginClient, github.GenericCommentEvent) error

type Heart

type Heart struct {
	// Adorees is a list of GitHub logins for members
	// for whom we will add emojis to comments
	Adorees []string `json:"adorees,omitempty"`
}

type IssueCommentHandler

type IssueCommentHandler func(PluginClient, github.IssueCommentEvent) error

type IssueHandler

type IssueHandler func(PluginClient, github.IssueEvent) error

type Label

type Label struct {
	// SigOrg is the organization that owns the
	// special interest groups tagged in this repo
	SigOrg string `json:"sig_org,omitempty"`
	// ID of the github team for the milestone maintainers (used for setting status labels)
	// You can curl the following endpoint in order to determine the github ID of your team
	// responsible for maintaining the milestones:
	// curl -H "Authorization: token <token>" https://api.github.com/orgs/<org-name>/teams
	MilestoneMaintainersID int `json:"milestone_maintainers_id,omitempty"`
}

type MergeWarning

type MergeWarning struct {
	// Repos is either of the form org/repos or just org.
	Repos []string `json:"repos,omitempty"`
	// List of channels on which a event is published.
	Channels []string `json:"channels,omitempty"`
	// A slack event is published if the user is not part of the WhiteList.
	WhiteList []string `json:"whitelist,omitempty"`
}

MergeWarning is a config for the slackevents plugin's manual merge warings. If a PR is pushed to any of the repos listed in the config then send messages to the all the slack channels listed if pusher is NOT in the whitelist.

type PluginAgent

type PluginAgent struct {
	PluginClient
	// contains filtered or unexported fields
}

func (*PluginAgent) Config

func (pa *PluginAgent) Config() *Configuration

func (*PluginAgent) GenericCommentHandlers

func (pa *PluginAgent) GenericCommentHandlers(owner, repo string) map[string]GenericCommentHandler

GenericCommentHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) IssueCommentHandlers

func (pa *PluginAgent) IssueCommentHandlers(owner, repo string) map[string]IssueCommentHandler

IssueCommentHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) IssueHandlers

func (pa *PluginAgent) IssueHandlers(owner, repo string) map[string]IssueHandler

IssueHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) Load

func (pa *PluginAgent) Load(path string) error

Load attempts to load config from the path. It returns an error if either the file can't be read or it contains an unknown plugin.

func (*PluginAgent) PullRequestHandlers

func (pa *PluginAgent) PullRequestHandlers(owner, repo string) map[string]PullRequestHandler

PullRequestHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) PushEventHandlers

func (pa *PluginAgent) PushEventHandlers(owner, repo string) map[string]PushEventHandler

PushEventHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) ReviewCommentEventHandlers

func (pa *PluginAgent) ReviewCommentEventHandlers(owner, repo string) map[string]ReviewCommentEventHandler

ReviewCommentEventHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) ReviewEventHandlers

func (pa *PluginAgent) ReviewEventHandlers(owner, repo string) map[string]ReviewEventHandler

ReviewEventHandlers returns a map of plugin names to handlers for the repo.

func (*PluginAgent) Set

func (pa *PluginAgent) Set(pc *Configuration)

Set attempts to set the plugins that are enabled on repos. Plugins are listed as a map from repositories to the list of plugins that are enabled on them. Specifying simply an org name will also work, and will enable the plugin on all repos in the org.

func (*PluginAgent) Start

func (pa *PluginAgent) Start(path string) error

Start starts polling path for plugin config. If the first attempt fails, then start returns the error. Future errors will halt updates but not stop.

func (*PluginAgent) StatusEventHandlers

func (pa *PluginAgent) StatusEventHandlers(owner, repo string) map[string]StatusEventHandler

StatusEventHandlers returns a map of plugin names to handlers for the repo.

type PluginClient

type PluginClient struct {
	GitHubClient *github.Client
	KubeClient   *kube.Client
	GitClient    *git.Client
	SlackClient  *slack.Client

	// Config provides information about the jobs
	// that we know how to run for repos.
	Config *config.Config
	// PluginConfig provides plugin-specific options
	PluginConfig *Configuration

	Logger *logrus.Entry
}

PluginClient may be used concurrently, so each entry must be thread-safe.

type PullRequestHandler

type PullRequestHandler func(PluginClient, github.PullRequestEvent) error

type PushEventHandler

type PushEventHandler func(PluginClient, github.PushEvent) error

type ReviewCommentEventHandler

type ReviewCommentEventHandler func(PluginClient, github.ReviewCommentEvent) error

type ReviewEventHandler

type ReviewEventHandler func(PluginClient, github.ReviewEvent) error

type Slack

type Slack struct {
	MentionChannels []string       `json:"mentionchannels,omitempty"`
	MergeWarnings   []MergeWarning `json:"mergewarnings,omitempty"`
}

type StatusEventHandler

type StatusEventHandler func(PluginClient, github.StatusEvent) error

type Trigger

type Trigger struct {
	// Repos is either of the form org/repos or just org.
	Repos []string `json:"repos,omitempty"`
	// TrustedOrg is the org whose members' PRs will be automatically built
	// for PRs to the above repos. The default is the PR's org.
	TrustedOrg string `json:"trusted_org,omitempty"`
}

Directories

Path Synopsis
Package hold contains a plugin which will allow users to label their own pull requests as not ready or ready for merge.
Package hold contains a plugin which will allow users to label their own pull requests as not ready or ready for merge.
Package size contains a Prow plugin which counts the number of lines changed in a pull request, buckets this number into a few size classes (S, L, XL, etc), and finally labels the pull request with this size.
Package size contains a Prow plugin which counts the number of lines changed in a pull request, buckets this number into a few size classes (S, L, XL, etc), and finally labels the pull request with this size.
Package wip will label a PR a work-in-progress if the author provides a prefix to their pull request title to the same effect.
Package wip will label a PR a work-in-progress if the author provides a prefix to their pull request title to the same effect.

Jump to

Keyboard shortcuts

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