plugins

package
v0.0.0-...-1552b08 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPushEvent

func ConvertPushEvent(e *gitee.PushEvent) github.PushEvent

func NewDispatcher

func NewDispatcher(c *ConfigAgent, ps Plugins) hook.Dispatcher

func NoteEventToCommentEvent

func NoteEventToCommentEvent(e *gitee.NoteEvent) github.GenericCommentEvent

Types

type ConfigAgent

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

func NewConfigAgent

func NewConfigAgent() *ConfigAgent

func (*ConfigAgent) Config

func (ca *ConfigAgent) Config() *Configurations

func (*ConfigAgent) Load

func (ca *ConfigAgent) Load(path string, checkUnknownPlugins bool, knownPlugins map[string]HelpProvider) error

func (*ConfigAgent) RegisterPluginConfigBuilder

func (ca *ConfigAgent) RegisterPluginConfigBuilder(name string, b PluginConfigBuilder)

func (*ConfigAgent) Start

func (ca *ConfigAgent) Start(path string, checkUnknownPlugins bool, knownPlugins map[string]HelpProvider) 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. If checkUnknownPlugins is true, unrecognized plugin names will make config loading fail.

type Configurations

type Configurations struct {
	// Plugins is a map of repositories (eg "k/k") to lists of
	// plugin names.
	// You can find a comprehensive list of the default avaulable plugins here
	// https://github.com/kubernetes/test-infra/tree/master/prow/plugins
	// note that you're also able to add external plugins.
	Plugins map[string][]string `json:"plugins,omitempty"`

	// Owners contains configuration related to handling OWNERS files.
	Owners origin.Owners `json:"owners,omitempty"`

	// ExternalPlugins is a map of repositories (eg "k/k") to lists of
	// external plugins.
	ExternalPlugins map[string][]ExternalPlugin `json:"external_plugins,omitempty"`
	// contains filtered or unexported fields
}

configuration is the top-level serialization target for plugin configuration.

func (*Configurations) EnabledReposForPlugin

func (c *Configurations) EnabledReposForPlugin(plugin string) (orgs, repos []string)

EnabledReposForPlugin returns the orgs and repos that have enabled the passed plugin.

func (*Configurations) GetPluginConfig

func (c *Configurations) GetPluginConfig(name string) PluginConfig

func (*Configurations) MDYAMLEnabled

func (c *Configurations) MDYAMLEnabled(org, repo string) bool

MDYAMLEnabled returns a boolean denoting if the passed repo supports YAML OWNERS config headers at the top of markdown (*.md) files. These function like OWNERS files but only apply to the file itself.

func (*Configurations) SkipCollaborators

func (c *Configurations) SkipCollaborators(org, repo string) bool

SkipCollaborators returns a boolean denoting if collaborator cross-checks are enabled for the passed repo. If it's true, approve and lgtm plugins rely solely on OWNERS files.

func (*Configurations) Validate

func (c *Configurations) Validate() error

type ExternalPlugin

type ExternalPlugin struct {
	// Name of the plugin.
	Name string `json:"name"`
	// Endpoint is the location of the external plugin. Defaults to
	// the name of the plugin, ie. "http://{{name}}".
	Endpoint string `json:"endpoint,omitempty"`
	// Events are the events that need to be demuxed by the hook
	// server to the external plugin. If no events are specified,
	// everything is sent.
	Events []string `json:"events,omitempty"`
}

ExternalPlugin holds configuration for registering an external plugin in prow.

type GetPluginConfig

type GetPluginConfig func(string) PluginConfig

type HelpProvider

type HelpProvider func(enabledRepos []config.OrgRepo) (*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 IssueHandler

type IssueHandler func(e *gitee.IssueEvent, log *logrus.Entry) error

IssueHandler defines the function contract for a gitee.IssueEvent handler.

type NoteEventHandler

type NoteEventHandler func(e *gitee.NoteEvent, log *logrus.Entry) error

NoteEventHandler defines the function contract for a gitee.NoteEvent handler.

type Plugin

type Plugin interface {
	PluginName() string
	NewPluginConfig() PluginConfig
	RegisterEventHandler(p Plugins)
	HelpProvider(enabledRepos []config.OrgRepo) (*pluginhelp.PluginHelp, error)
}

type PluginConfig

type PluginConfig interface {
	Validate() error
	SetDefault()
}

type PluginConfigBuilder

type PluginConfigBuilder func() PluginConfig

type Plugins

type Plugins interface {
	RegisterHelper(name string, fn HelpProvider)
	RegisterIssueHandler(name string, fn IssueHandler)
	RegisterPullRequestHandler(name string, fn PullRequestHandler)
	RegisterPushEventHandler(name string, fn PushEventHandler)
	RegisterNoteEventHandler(name string, fn NoteEventHandler)

	HelpProviders() map[string]HelpProvider
}

func NewPluginManager

func NewPluginManager() Plugins

type PullRequestHandler

type PullRequestHandler func(e *gitee.PullRequestEvent, log *logrus.Entry) error

PullRequestHandler defines the function contract for a gitee.PullRequestEvent handler.

type PushEventHandler

type PushEventHandler func(e *gitee.PushEvent, log *logrus.Entry) error

PushEventHandler defines the function contract for a gitee.PushEvent handler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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