middleware

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: GPL-2.0, GPL-3.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Middleware

Each middleware implements a function with the following signature

func (middleware CatchMiddleware) Run(
	invocation *models.PipelineInvocation,
	result *models.RunResult,
	next func(*models.PipelineInvocation, *models.RunResult),
	logger *logging.MiddlewareLogger,
	stack *middleware.Stack) {}

Built-in middleware

catch - Error Handler
dir - Directory Navigator
docker - Docker Executor
each - Input Duplicator
timer - Directory Timer Middleware

Writing your own middleware

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookUpPipelineDefinition

func LookUpPipelineDefinition(definitionsLookup models.PipelineDefinitionsLookup, identifier string, rootFileName string) (*models.PipelineDefinition, bool)

func ParseArguments

func ParseArguments(
	middlewareArguments interface{},
	middlewareIdentifier string,
	run *models.PipelineRun,
) bool

func ParseArgumentsIncludingParents

func ParseArgumentsIncludingParents(
	middlewareArguments interface{},
	middlewareIdentifier string,
	run *models.PipelineRun,
) bool

Types

type Arguments

type Arguments = map[string]interface{}

type ExecutionContext

type ExecutionContext struct {
	PipelineFiles   []models.PipelineFile
	Definitions     models.PipelineDefinitionsLookup
	MiddlewareStack []Middleware
	Defaults        models.DefaultSettings
	Hooks           models.HookDefinitions

	Log *logrus.Logger

	ProjectPath  string
	RootFileName string

	SelectableFiles []string

	Runs []*models.PipelineRun

	ActivityIndicator logging.ActivityIndicator

	UserPromptImplementation func(
		label string,
		items []string,
		initialSelection int,
		size int,
		input io.ReadCloser,
		output io.WriteCloser,
	) (int, string, error)
	// contains filtered or unexported fields
}

func NewExecutionContext

func NewExecutionContext(options ...ExecutionContextOption) *ExecutionContext

func (*ExecutionContext) Cancel

func (executionContext *ExecutionContext) Cancel() error

func (*ExecutionContext) CancelAll

func (executionContext *ExecutionContext) CancelAll() error

func (*ExecutionContext) Execute

func (executionContext *ExecutionContext) Execute(pipelineIdentifier string, writer io.Writer)

func (*ExecutionContext) FullRun

func (executionContext *ExecutionContext) FullRun(options ...FullRunOption) *models.PipelineRun

func (*ExecutionContext) PipelineFileAtPath

func (executionContext *ExecutionContext) PipelineFileAtPath(path string) (*models.PipelineFile, error)

func (*ExecutionContext) SetUpPipelines

func (executionContext *ExecutionContext) SetUpPipelines(args []string) error

type ExecutionContextOption

type ExecutionContextOption func(*ExecutionContext)

func WithActivityIndicator

func WithActivityIndicator(activityIndicator logging.ActivityIndicator) ExecutionContextOption

func WithDefinitionsLookup

func WithDefinitionsLookup(definitions models.PipelineDefinitionsLookup) ExecutionContextOption

func WithExecutionFunction

func WithExecutionFunction(executionFunction func(run *models.PipelineRun)) ExecutionContextOption

func WithLogger

func WithLogger(logger *logrus.Logger) ExecutionContextOption

func WithMiddlewareStack

func WithMiddlewareStack(stack []Middleware) ExecutionContextOption

func WithParser

func WithParser(parser *parsers.Parser) ExecutionContextOption

func WithProjectPath

func WithProjectPath(projectPath string) ExecutionContextOption

func WithUserPromptImplementation

func WithUserPromptImplementation(implementation func(
	label string,
	items []string,
	initialSelection int,
	size int,
	input io.ReadCloser,
	output io.WriteCloser,
) (int, string, error)) ExecutionContextOption

type FullRunOption

type FullRunOption func(*FullRunOptions)

func WithArguments

func WithArguments(arguments map[string]interface{}) FullRunOption

func WithIdentifier

func WithIdentifier(identifier *string) FullRunOption

func WithLogWriter

func WithLogWriter(logWriter io.WriteCloser) FullRunOption

func WithParentRun

func WithParentRun(parentRun *models.PipelineRun) FullRunOption

func WithSetupFunc

func WithSetupFunc(preCallback func(*models.PipelineRun)) FullRunOption

func WithTearDownFunc

func WithTearDownFunc(postCallback func(*models.PipelineRun)) FullRunOption

type FullRunOptions

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

type Middleware

type Middleware interface {
	String() string
	Apply(
		run *models.PipelineRun,
		next func(*models.PipelineRun),
		executionContext *ExecutionContext,
	)
}

type PipelineReference

type PipelineReference = map[*string]Arguments

Jump to

Keyboard shortcuts

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