plugins

package
v0.0.678 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: Apache-2.0 Imports: 21 Imported by: 7

Documentation

Index

Constants

AboutThisBot contains the text of both AboutThisBotWithoutCommands and AboutThisBotCommands.

View Source
const AboutThisBotCommands = "I understand the commands that are listed [here](https://go.k8s.io/bot-commands)."

AboutThisBotCommands contains the message that links to the commands the bot understand.

View Source
const AboutThisBotWithoutCommands = "" /* 347-byte string literal not displayed */

AboutThisBotWithoutCommands contains the message that explains how to interact with the bot.

Variables

This section is empty.

Functions

func EventsForPlugin

func EventsForPlugin(name string) []string

EventsForPlugin returns the registered events for the passed plugin.

func FormatICResponse

func FormatICResponse(ic scm.Comment, 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 FormatSimpleResponse

func FormatSimpleResponse(to, message string) string

FormatSimpleResponse formats a response that does not warrant additional explanation in the details section.

func HelpProviders

func HelpProviders() map[string]HelpProvider

HelpProviders returns the map of registered plugins with their associated HelpProvider.

func RegisterGenericCommentHandler

func RegisterGenericCommentHandler(name string, fn GenericCommentHandler, help HelpProvider)

RegisterGenericCommentHandler registers a plugin's scm.Comment handler.

func RegisterIssueCommentHandler

func RegisterIssueCommentHandler(name string, fn IssueCommentHandler, help HelpProvider)

RegisterIssueCommentHandler registers a plugin's scm.Comment handler.

func RegisterIssueHandler

func RegisterIssueHandler(name string, fn IssueHandler, help HelpProvider)

RegisterIssueHandler registers a plugin's scm.Issue handler.

func RegisterPullRequestHandler

func RegisterPullRequestHandler(name string, fn PullRequestHandler, help HelpProvider)

RegisterPullRequestHandler registers a plugin's scm.PullRequest handler.

func RegisterPushEventHandler

func RegisterPushEventHandler(name string, fn PushEventHandler, help HelpProvider)

RegisterPushEventHandler registers a plugin's scm.PushHook handler.

func RegisterReviewCommentEventHandler

func RegisterReviewCommentEventHandler(name string, fn ReviewCommentEventHandler, help HelpProvider)

RegisterReviewCommentEventHandler registers a plugin's scm.PullRequestCommentHook handler.

func RegisterReviewEventHandler

func RegisterReviewEventHandler(name string, fn ReviewEventHandler, help HelpProvider)

RegisterReviewEventHandler registers a plugin's ReviewHook handler.

func RegisterStatusEventHandler

func RegisterStatusEventHandler(name string, fn StatusEventHandler, help HelpProvider)

RegisterStatusEventHandler registers a plugin's scm.Status handler.

Types

type Agent

type Agent struct {
	SCMProviderClient *scmprovider.Client
	LauncherClient    launcher.PipelineLauncher
	GitClient         git2.Client
	KubernetesClient  kubernetes.Interface
	LighthouseClient  lighthouseclient.LighthouseJobInterface
	ServerURL         *url.URL

	OwnersClient *repoowners.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
	// contains filtered or unexported fields
}

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

func NewAgent

func NewAgent(configAgent *config.Agent, pluginConfigAgent *ConfigAgent, clientAgent *ClientAgent, serverURL *url.URL, logger *logrus.Entry) Agent

NewAgent bootstraps a new Agent struct from the passed dependencies.

func (*Agent) CommentPruner

func (a *Agent) CommentPruner() (*commentpruner.EventClient, error)

CommentPruner will return the commentpruner.EventClient attached to the agent or an error if one is not attached.

func (*Agent) InitializeCommentPruner

func (a *Agent) InitializeCommentPruner(org, repo string, pr int)

InitializeCommentPruner attaches a commentpruner.EventClient to the agent to handle pruning comments.

type Approve

type Approve = plugins.Approve

Approve is an alias to the type in lighthouse-config

type Blockade

type Blockade = plugins.Blockade

Blockade is an alias to the type in lighthouse-config

type Blunderbuss

type Blunderbuss = plugins.Blunderbuss

Blunderbuss is an alias to the type in lighthouse-config

type Cat

type Cat = plugins.Cat

Cat is an alias to the type in lighthouse-config

type CherryPickUnapproved

type CherryPickUnapproved = plugins.CherryPickUnapproved

CherryPickUnapproved is an alias to the type in lighthouse-config

type ClientAgent

type ClientAgent struct {
	BotName           string
	SCMProviderClient *scm.Client

	KubernetesClient kubernetes.Interface
	GitClient        git2.Client
	LauncherClient   launcher.PipelineLauncher
	LighthouseClient lighthouseclient.LighthouseJobInterface
}

ClientAgent contains the various clients that are attached to the Agent.

type ConfigAgent

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

ConfigAgent contains the agent mutex and the Agent configuration.

func (*ConfigAgent) Config

func (pa *ConfigAgent) Config() *Configuration

Config returns the agent current Configuration.

func (*ConfigAgent) GenericCommentHandlers

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

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

func (*ConfigAgent) IssueCommentHandlers

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

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

func (*ConfigAgent) IssueHandlers

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

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

func (*ConfigAgent) Load

func (pa *ConfigAgent) 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 the configuration is invalid.

func (*ConfigAgent) LoadYAMLConfig

func (pa *ConfigAgent) LoadYAMLConfig(data []byte) (*Configuration, error)

LoadYAMLConfig loads the configuration from the given data

func (*ConfigAgent) PullRequestHandlers

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

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

func (*ConfigAgent) PushEventHandlers

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

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

func (*ConfigAgent) ReviewCommentEventHandlers

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

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

func (*ConfigAgent) ReviewEventHandlers

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

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

func (*ConfigAgent) Set

func (pa *ConfigAgent) 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 (*ConfigAgent) Start

func (pa *ConfigAgent) 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 (*ConfigAgent) StatusEventHandlers

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

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

type ConfigMapSpec

type ConfigMapSpec = plugins.ConfigMapSpec

ConfigMapSpec is an alias to the type in lighthouse-config

type ConfigUpdate added in v0.0.661

type ConfigUpdate = plugins.ConfigUpdater

ConfigUpdate is an alias to the type in lighthouse-config

type Configuration

type Configuration = plugins.Configuration

Configuration is an alias to the configuration type in lighthouse-config

type ExternalPlugin

type ExternalPlugin = plugins.ExternalPlugin

ExternalPlugin is an alias to the type in lighthouse-config

type GenericCommentHandler

type GenericCommentHandler func(Agent, scmprovider.GenericCommentEvent) error

GenericCommentHandler defines the function contract for a scm.Comment handler.

type Golint

type Golint = plugins.Golint

Golint is an alias to the type in lighthouse-config

type Heart

type Heart = plugins.Heart

Heart is an alias to the type in lighthouse-config

type HelpProvider

type HelpProvider func(config *Configuration, enabledRepos []string) (*pluginhelp.PluginHelp, error)

HelpProvider defines the function type that construct a pluginhelp.PluginHelp for enabled plugins. It takes into account the plugins configuration and enabled repositories.

type IssueCommentHandler

type IssueCommentHandler func(Agent, scm.IssueCommentHook) error

IssueCommentHandler defines the function contract for a scm.Comment handler.

type IssueHandler

type IssueHandler func(Agent, scm.Issue) error

IssueHandler defines the function contract for a scm.Issue handler.

type Label

type Label = plugins.Label

Label is an alias to the type in lighthouse-config

type Lgtm

type Lgtm = plugins.Lgtm

Lgtm is an alias to the type in lighthouse-config

type MergeWarning

type MergeWarning = plugins.MergeWarning

MergeWarning is an alias to the type in lighthouse-config

type Milestone

type Milestone = plugins.Milestone

Milestone is an alias to the type in lighthouse-config

type Owners

type Owners = plugins.Owners

Owners is an alias to the type in lighthouse-config

type PullRequestHandler

type PullRequestHandler func(Agent, scm.PullRequestHook) error

PullRequestHandler defines the function contract for a scm.PullRequest handler.

type PushEventHandler

type PushEventHandler func(Agent, scm.PushHook) error

PushEventHandler defines the function contract for a scm.PushHook handler.

type RequireMatchingLabel

type RequireMatchingLabel = plugins.RequireMatchingLabel

RequireMatchingLabel is an alias to the type in lighthouse-config

type RequireSIG

type RequireSIG = plugins.RequireSIG

RequireSIG is an alias to the type in lighthouse-config

type ReviewCommentEventHandler

type ReviewCommentEventHandler func(Agent, scm.PullRequestCommentHook) error

ReviewCommentEventHandler defines the function contract for a scm.PullRequestCommentHook handler.

type ReviewEventHandler

type ReviewEventHandler func(Agent, scm.ReviewHook) error

ReviewEventHandler defines the function contract for a ReviewHook handler.

type SigMention

type SigMention = plugins.SigMention

SigMention is an alias to the type in lighthouse-config

type Size

type Size = plugins.Size

Size is an alias to the type in lighthouse-config

type Slack

type Slack = plugins.Slack

Slack is an alias to the type in lighthouse-config

type StatusEventHandler

type StatusEventHandler func(Agent, scm.Status) error

StatusEventHandler defines the function contract for a scm.Status handler.

type Trigger

type Trigger = plugins.Trigger

Trigger is an alias to the type in lighthouse-config

type Welcome

type Welcome = plugins.Welcome

Welcome is an alias to the type in lighthouse-config

Directories

Path Synopsis
Package blockade defines a plugin that adds the 'do-not-merge/blocked-paths' label to PRs that modify protected file paths.
Package blockade defines a plugin that adds the 'do-not-merge/blocked-paths' label to PRs that modify protected file paths.
Package cat adds cat images to an issue or PR in response to a /meow comment
Package cat adds cat images to an issue or PR in response to a /meow comment
Package cherrypickunapproved adds the `do-not-merge/cherry-pick-not-approved` label to PRs against a release branch which do not have the `cherry-pick-approved` label.
Package cherrypickunapproved adds the `do-not-merge/cherry-pick-not-approved` label to PRs against a release branch which do not have the `cherry-pick-approved` label.
Package dog adds dog images to the issue or PR in response to a /woof comment
Package dog adds dog images to the issue or PR in response to a /woof comment
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 lgtm implements the lgtm plugin
Package lgtm implements the lgtm plugin
Package milestone implements the `/milestone` command which allows members of the milestone maintainers team to specify a milestone to be applied to an Issue or PR.
Package milestone implements the `/milestone` command which allows members of the milestone maintainers team to specify a milestone to be applied to an Issue or PR.
Package milestonestatus implements the `/status` command which allows members of the milestone maintainers team to specify a `status/*` label to be applied to an Issue or PR.
Package milestonestatus implements the `/status` command which allows members of the milestone maintainers team to specify a `status/*` label to be applied to an Issue or PR.
Package override supports the /override context command.
Package override supports the /override context command.
Package pony adds pony images to the issue or PR in response to a /pony comment
Package pony adds pony images to the issue or PR in response to a /pony comment
Package sigmention recognize SIG '@' mentions and adds 'sig/*' and 'kind/*' labels as appropriate.
Package sigmention recognize SIG '@' mentions and adds 'sig/*' and 'kind/*' labels as appropriate.
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 skip implements the `/skip` command which allows users to clean up commit statuses of non-blocking presubmits on PRs.
Package skip implements the `/skip` command which allows users to clean up commit statuses of non-blocking presubmits on PRs.
Package stage defines a Prow plugin that defines the stage of the issue in the features process.
Package stage defines a Prow plugin that defines the stage of the issue in the features process.
Package welcome implements a prow plugin to welcome new contributors
Package welcome implements a prow plugin to welcome new contributors
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