githubeventserver

package
v0.0.0-...-37c3036 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubEventServer

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

GitHubEventServer hold all the information needed for the github event server implementation.

func New

func New(o Options, hmacTokenGenerator func() []byte, logger *logrus.Entry) *GitHubEventServer

New creates a new GitHubEventServer from the given arguments. It also assigns the serveMuxHandler in the http.ServeMux.

func (*GitHubEventServer) GracefulShutdown

func (g *GitHubEventServer) GracefulShutdown()

GracefulShutdown handles all requests sent before receiving the shutdown signal.

func (*GitHubEventServer) ListenAndServe

func (g *GitHubEventServer) ListenAndServe() error

ListenAndServe runs the http server

func (*GitHubEventServer) RegisterCustomFuncHandle

func (g *GitHubEventServer) RegisterCustomFuncHandle(endpoint string, fn func(w http.ResponseWriter, r *http.Request))

RegisterCustomFuncHandle registers a custom func(w http.ResponseWriter, r *http.Request) with the given endpoint in the GitHubEventServerOptions http.ServeMux

func (*GitHubEventServer) RegisterExternalPlugins

func (g *GitHubEventServer) RegisterExternalPlugins(p map[string][]plugins.ExternalPlugin)

RegisterExternalPlugins registers the external plugins in GitHubEventServerOptions

func (*GitHubEventServer) RegisterHandleIssueCommentEvent

func (g *GitHubEventServer) RegisterHandleIssueCommentEvent(fn IssueCommentEventHandler)

RegisterHandleIssueCommentEvent registers an IssueCommentEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterHandlePullRequestEvent

func (g *GitHubEventServer) RegisterHandlePullRequestEvent(fn PullRequestHandler)

RegisterHandlePullRequestEvent registers an PullRequestHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterHelpProvider

func (g *GitHubEventServer) RegisterHelpProvider(helpProvider func([]config.OrgRepo) (*pluginhelp.PluginHelp, error), log *logrus.Entry)

RegisterHelpProvider registers a help provider function in GitHubEventServerOptions http.ServeMux

func (*GitHubEventServer) RegisterIssueEventHandler

func (g *GitHubEventServer) RegisterIssueEventHandler(fn IssueEventHandler)

RegisterIssueEventHandler registers an IssueEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterPluginHelpAgentHandle

func (g *GitHubEventServer) RegisterPluginHelpAgentHandle(endpoint string, helpAgent *pluginhelp_hook.HelpAgent)

RegisterPluginHelpAgentHandle registers a help agent in with the given endpoint in the GitHubEventServerOptions http.ServeMux

func (*GitHubEventServer) RegisterPushEventHandler

func (g *GitHubEventServer) RegisterPushEventHandler(fn PushEventHandler)

RegisterPushEventHandler registers an PushEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterRegistryPackageEventHandler

func (g *GitHubEventServer) RegisterRegistryPackageEventHandler(fn RegistryPackageEventHandler)

RegisterWorkflowRunEventHandler registers a RegistryPackageEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterReviewCommentEventHandler

func (g *GitHubEventServer) RegisterReviewCommentEventHandler(fn ReviewCommentEventHandler)

RegisterReviewCommentEventHandler registers an ReviewCommentEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterReviewEventHandler

func (g *GitHubEventServer) RegisterReviewEventHandler(fn ReviewEventHandler)

RegisterReviewEventHandler registers an ReviewEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterStatusEventHandler

func (g *GitHubEventServer) RegisterStatusEventHandler(fn StatusEventHandler)

RegisterStatusEventHandler registers an StatusEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) RegisterWorkflowRunEventHandler

func (g *GitHubEventServer) RegisterWorkflowRunEventHandler(fn WorkflowRunEventHandler)

RegisterWorkflowRunEventHandler registers an WorkflowRunEventHandler function in GitHubEventServerOptions

func (*GitHubEventServer) Shutdown

func (g *GitHubEventServer) Shutdown(ctx context.Context) error

Shutdown shutdowns the http server

type IssueCommentEventHandler

type IssueCommentEventHandler func(*logrus.Entry, github.IssueCommentEvent)

IssueCommentEventHandler is a type of function that handles GitHub's issue comment events.

type IssueEventHandler

type IssueEventHandler func(*logrus.Entry, github.IssueEvent)

IssueEventHandler is a type of function that handles GitHub's issue events.

type Metrics

type Metrics struct {
	WebhookCounter       *prometheus.CounterVec
	ResponseCounter      *prometheus.CounterVec
	PluginHandleDuration *prometheus.HistogramVec
	PluginHandleErrors   *prometheus.CounterVec
	*plugins.Metrics
}

Metrics is a set of metrics gathered by hook.

func NewMetrics

func NewMetrics() *Metrics

NewMetrics creates a new set of metrics for the hook server.

type Options

type Options struct {
	// Metrics will be used to expose prometheus metrics from the
	// github event server operations.
	Metrics *Metrics
	// contains filtered or unexported fields
}

Options holds the endpoint and port information that can be used to create a new github event server

func (*Options) Bind

func (o *Options) Bind(fs *flag.FlagSet)

Bind binds the flags into the given flagset.

func (*Options) DefaultAndValidate

func (o *Options) DefaultAndValidate() error

DefaultAndValidate validates the option's values and defaults them if they are empty.

type PluginMetrics

type PluginMetrics struct {
	ConfigMapGauges *prometheus.GaugeVec
}

PluginMetrics is a set of metrics that are gathered by plugins. It is up the consumers of these metrics to ensure that they update the values in a thread-safe manner.

type PullRequestHandler

type PullRequestHandler func(*logrus.Entry, github.PullRequestEvent)

PullRequestHandler is a type of function that handles GitHub's pull request events.

type PushEventHandler

type PushEventHandler func(*logrus.Entry, github.PushEvent)

PushEventHandler is a type of function that handles GitHub's push events.

type RegistryPackageEventHandler

type RegistryPackageEventHandler func(*logrus.Entry, github.RegistryPackageEvent)

RegistryPackageEventHandler is a type of function that handles GitHub's registry package events.

type ReviewCommentEventHandler

type ReviewCommentEventHandler func(*logrus.Entry, github.ReviewCommentEvent)

ReviewCommentEventHandler is a type of function that handles GitHub's review comment events

type ReviewEventHandler

type ReviewEventHandler func(*logrus.Entry, github.ReviewEvent)

ReviewEventHandler is a type of function that handles GitHub's review events.

type StatusEventHandler

type StatusEventHandler func(*logrus.Entry, github.StatusEvent)

StatusEventHandler is a type of function that handles GitHub's status events.

type WorkflowRunEventHandler

type WorkflowRunEventHandler func(*logrus.Entry, github.WorkflowRunEvent)

WorkflowRunEventHandler is a type of function that handles GitHub's workflow run events.

Jump to

Keyboard shortcuts

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