hooks

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Defined added in v0.1.0

func Defined() bool

func Parse

func Parse()

func Runner

func Runner(path, filename string, ctx speccontext.GitContext, partsCtx parts.Context) error

Types

type AWSLambdaHook added in v0.1.0

type AWSLambdaHook struct {
	AssumeRole     string `mapstructure:"assume_role"`
	FunctionName   string `mapstructure:"function_name"`
	InvocationType string `mapstructure:"invocation_type"` // RequestResponse, Event, DryRun
	Region         string
	Payload        string
}

func (*AWSLambdaHook) Run added in v0.1.0

func (l *AWSLambdaHook) Run(path string) error

type Config

type Config struct {
	Hooks []Hook
}

type Hook

type Hook struct {
	Type         string
	PathFilter   string            `mapstructure:"path_filter"`
	MatchContext map[string]string `mapstructure:"match_context"`
	RequireEnv   []string          `mapstructure:"require_env"`
	Spec         interface{}
}

func (*Hook) CanRun

func (h *Hook) CanRun(path string, ctx speccontext.GitContext, partsCtx parts.Context) (matched bool)

CanRun ensures the hook can be executed. It checks that the path matches what specified in path_filter checks that match_context rules are satisfied. If the match defined with "/" as prefix and suffix it matches it as a regexp. To execute hook for a part upload you have to specify the match_context["part"] require_env matches can be a full line, specified like: "CI=true" or only with a name of the variable "CI"

func (*Hook) Definition

func (h *Hook) Definition() Spec

type HttpHook added in v0.0.13

type HttpHook struct {
	Method  string
	Url     string
	Body    string
	Headers map[string]string
}

func (*HttpHook) Run added in v0.0.13

func (l *HttpHook) Run(path string) error

type LocalHook

type LocalHook struct {
	Command string
}

func (*LocalHook) Run

func (l *LocalHook) Run(path string) error

type NoopHook

type NoopHook struct{}

func (NoopHook) Run

func (n NoopHook) Run(_ string) error

type Spec

type Spec interface {
	Run(path string) error
}

Jump to

Keyboard shortcuts

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