plugins

package
v0.0.0-...-191e092 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const AboutThisBot = "Instructions for interacting with me using Merge Requests comments are available at https://github.com/cosminilie/gitbot"

Variables

This section is empty.

Functions

func FormatResponse

func FormatResponse(ic gitlabhook.MergeRequestCommentEvent, s string) string

FormatResponse nicely formats a response to an issue comment.

func RegisterGroupHandler

func RegisterGroupHandler(name string, fn GroupHandler)

func RegisterMergeCommentEventHandler

func RegisterMergeCommentEventHandler(name string, fn MergeCommentEventHandler)

RegisterMergeCommentEventHandler registers MergeCommentEventHandler in the global handler register

Types

type GroupHandler

type GroupHandler func(*PluginClient, string) error

type MergeCommentEventHandler

type MergeCommentEventHandler func(*PluginClient, gitlabhook.MergeRequestCommentEvent) error

MergeCommentEventHandler func that handle merge request comments

type PluginAgent

type PluginAgent struct {
	PluginClient

	Repos      map[string]Repo
	GroupRepos map[string]Repo
	// contains filtered or unexported fields
}

PluginAgent is the main struct which store the information needed to associated plugins with repo and pass PluginClients to each registered handler

func NewPluginAgent

func NewPluginAgent(logger log.Logger, gci *gitlab.Client, pluginReposChan chan Repo) *PluginAgent

NewPluginAgent creates a new plugin agent

func (*PluginAgent) GroupHandlers

func (pa *PluginAgent) GroupHandlers(repo string) map[string]GroupHandler

GlobalHandlers returns a map of plugin names to apply for all repos without waiting for events.

func (*PluginAgent) MergeCommentEventHandlers

func (pa *PluginAgent) MergeCommentEventHandlers(repo string) map[string]MergeCommentEventHandler

StatusEventHandlers returns a map of plugin names to merge request comments handler for the repo.

type PluginClient

type PluginClient struct {
	GitLabClient *gitlab.Client
	Repos        map[string]Repo
	Pmut         sync.Mutex
}

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

type Repo

type Repo struct {
	Name      string   `hcl:",key"`
	Plugins   []string `hcl:"plugins"`
	Approvers []string `hcl:"approvers"`
}

Repo struct in loading HCL configuration. Part of the config struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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