plugin

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context) *protoV1.Context

Types

type ExecOptions

type ExecOptions struct {
	Args       []string
	Executable string
}

ExecOptions define how to start the plugin in a sub-process. Args contains all arguments to pass to the command. Executable is the executable to execute.

func GetPluginExec

func GetPluginExec(path, javaExec, pythonExec string) ExecOptions

type Plugin

type Plugin struct {
	Name     string
	Provider plugin.Provider
	// contains filtered or unexported fields
}

func (*Plugin) Apply

func (p *Plugin) Apply(ctx context.Context) error

Apply implements action.Action

func (*Plugin) Do

func (p *Plugin) Do(ctx context.Context) (bool, error)

Do implements filter.Filter.

func (*Plugin) ExecuteActions

func (*Plugin) ExecuteFilters

func (*Plugin) OnPrClosed

func (*Plugin) OnPrCreated

func (*Plugin) OnPrMerged

func (*Plugin) Shutdown added in v0.29.0

Shutdown lets a plugin know that its process is about to be stopped. A plugin can clean up any resources before it is stopped.

func (*Plugin) Start

func (p *Plugin) Start(opts StartOptions) error

func (*Plugin) Stop

func (p *Plugin) Stop()

Stop stops the plugin process. It calls the Shutdown RPC method before it stops the process.

func (*Plugin) String

func (p *Plugin) String() string

String implements action.Action String implements filter.Filter

type StartOptions

type StartOptions struct {
	Address      string
	Config       map[string]string
	Exec         ExecOptions
	OnDataStderr StdioHandler
	OnDataStdout StdioHandler
}

StartOptions define options to connect to a plugin. Config contains configuration sent to the plugin right after the connection is established. If Address is empty, then Exec is used to start the plugin before connecting to it. If Address is not empty, then the code connects to that address directly. OnDataStderr and OnDataStdout capture the stderr and stdout streams of the plugin. Writes the output of the streams to the log if unset.

type StdioHandler

type StdioHandler func(pluginName string, msg []byte)

StdioHandler describes a function that receives data sent by a plugin to stdout/stderr.

func NewStderrHandler

func NewStderrHandler(level zapcore.Level, logger *zap.SugaredLogger) StdioHandler

NewStderrHandler returns an StdioHandler for the stream "stderr".

func NewStdioHandler

func NewStdioHandler(defaultLevel zapcore.Level, logger *zap.SugaredLogger, stream string) StdioHandler

NewStdioHandler returns a StdioHandler that adds a message to the log when it receives data. `defaultLevel` denotes the level to log messages if a log message does not set its own level. `stream` is the identifier of the stream from which the data was read.

func NewStdoutHandler

func NewStdoutHandler(level zapcore.Level, logger *zap.SugaredLogger) StdioHandler

NewStdoutHandler returns an StdioHandler for the stream "stdout".

Jump to

Keyboard shortcuts

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