engine

package
v0.0.0-...-ab8736f Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadSecretFile

func ReadSecretFile(filename string) (map[string]string, error)

func ReadSecretFromEnv

func ReadSecretFromEnv() map[string]string

Types

type Hook

type Hook struct {
	Name       string
	Action     string
	Handlers   map[string][]*Task `yaml:"handlers"`
	Tasks      []*Task            `yaml:"tasks"`
	GlobalVars map[string]string  `yaml:"vars"`
	HookEngine *HookEngine
}

func (*Hook) AsyncRun

func (h *Hook) AsyncRun(run *Run)

func (*Hook) GetRun

func (h *Hook) GetRun(id string) (*Run, error)

func (*Hook) Run

func (h *Hook) Run() (*Run, error)

type HookEngine

type HookEngine struct {
	ConfigDir string
	Secrets   map[string]string
}

func NewHookEngine

func NewHookEngine(configDir string) *HookEngine

func (*HookEngine) Hooks

func (e *HookEngine) Hooks() ([]*Hook, error)

func (*HookEngine) ReadHook

func (e *HookEngine) ReadHook(path string, name string, action string) (*Hook, error)

func (*HookEngine) ReadHookFromFile

func (e *HookEngine) ReadHookFromFile(p string) (*Hook, error)

type HookStepRunResponse

type HookStepRunResponse struct {
	Stdout []byte
	Stderr []byte
}

type Run

type Run struct {
	Hook      *Hook
	ID        string
	ExitCode  int
	Completed bool
	Output    string
	Registers map[string]string
	Secrets   map[string]string
}

func NewRun

func NewRun(h *Hook) (*Run, error)

func (*Run) InjectSecrets

func (r *Run) InjectSecrets(secrets map[string]string)

func (*Run) Interpolate

func (r *Run) Interpolate(input string, vars map[string]string) string

func (*Run) Log

func (r *Run) Log() string

func (*Run) MakeEnv

func (r *Run) MakeEnv(more map[string]string) map[string]string

func (*Run) RunHandler

func (r *Run) RunHandler(src *Task, handlerName string) error

func (*Run) RunTask

func (r *Run) RunTask(t *Task) error

type Task

type Task struct {
	HandlerName          string            `yaml:"handler"`
	Name                 string            `yaml:"name"`
	Command              string            `yaml:"command"`
	Retry                int               `yaml:"retry"`
	Interval             int               `yaml:"interval"`
	Timeout              int               `yaml:"timeout"`
	OnFailure            string            `yaml:"on_failure"`
	ContinueAfterFailure bool              `yaml:"continue_after_failure"`
	OnlyIf               string            `yaml:"only_if"`
	Register             string            `yaml:"register"`
	Vars                 map[string]string `yaml:"vars"`
	Cd                   string            `yaml:"cd"`
}

Jump to

Keyboard shortcuts

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