executor

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StepHandlers map[string]StepHandler

Functions

func CheckCommandPath

func CheckCommandPath(name string, commandPath string, depth int) error

func CommandStepHandler

func CommandStepHandler(corkDir string, executor *StepsExecutor, stream streamer.StepStream, step *definition.Step) (map[string]string, error)

CommandStepHandler - Handles executing a command step

func ContainerStepHandler

func ContainerStepHandler(corkDir string, executor *StepsExecutor, stream streamer.StepStream, step *definition.Step) (map[string]string, error)

ContainerStepHandler - Handles executing a command step

func ExportStepHandler

func ExportStepHandler(corkDir string, executor *StepsExecutor, stream streamer.StepStream, step *definition.Step) (map[string]string, error)

ExportStepHandler - Handles exporting variables from a stage execution

func IsCommandDoesNotExist

func IsCommandDoesNotExist(err error) bool

func IsStepDoesNotExist

func IsStepDoesNotExist(err error) bool

func RegisterHandler

func RegisterHandler(handlerName string, handler StepHandler)

func RegisterRunner added in v0.2.0

func RegisterRunner(name string, factory StepRunnerFactory)

Types

type Command

type Command struct {
	Name string
	Path string
}

func LoadCommand

func LoadCommand(corkDir string, name string) (*Command, error)

func (*Command) ExecCommand

func (s *Command) ExecCommand() *exec.Cmd

type CommandDoesNotExist

type CommandDoesNotExist struct {
	Name    string
	Message string
}

func (CommandDoesNotExist) Error

func (sdne CommandDoesNotExist) Error() string

type CommandInvalid

type CommandInvalid struct {
	Name    string
	Message string
}

func (CommandInvalid) Error

func (si CommandInvalid) Error() string

type CommandStepRunner added in v0.2.0

type CommandStepRunner struct {
	Params       StepRunnerParams
	Cmd          *exec.Cmd
	StdinPiper   *StdinPiper
	StepStreamer *streamer.StepStreamer
}

func (*CommandStepRunner) HandleInput added in v0.2.0

func (c *CommandStepRunner) HandleInput(bytes []byte) error

func (*CommandStepRunner) HandleSignal added in v0.2.0

func (c *CommandStepRunner) HandleSignal(signal int32) error

func (*CommandStepRunner) Initialize added in v0.2.0

func (c *CommandStepRunner) Initialize(params StepRunnerParams) error

func (*CommandStepRunner) Run added in v0.2.0

func (c *CommandStepRunner) Run()

type ExecContext added in v0.2.0

type ExecContext struct {
	CorkDir     string
	WorkDir     string
	HostWorkDir string
	CacheDir    string
	OutputsDir  string
}

type ExportStepRunner added in v0.2.0

type ExportStepRunner struct {
	Params StepRunnerParams
}

func (*ExportStepRunner) HandleInput added in v0.2.0

func (e *ExportStepRunner) HandleInput(bytes []byte) error

func (*ExportStepRunner) HandleSignal added in v0.2.0

func (e *ExportStepRunner) HandleSignal(signal int32) error

func (*ExportStepRunner) Initialize added in v0.2.0

func (e *ExportStepRunner) Initialize(params StepRunnerParams) error

func (*ExportStepRunner) Run added in v0.2.0

func (e *ExportStepRunner) Run()

type StdinPiper added in v0.2.0

type StdinPiper struct {
	InputBytesChan chan []byte
	KillInput      chan bool
}

func NewStdinPiper added in v0.2.0

func NewStdinPiper() *StdinPiper

func (*StdinPiper) Kill added in v0.2.0

func (s *StdinPiper) Kill()

func (*StdinPiper) Read added in v0.2.0

func (s *StdinPiper) Read(p []byte) (n int, err error)

func (*StdinPiper) Write added in v0.2.0

func (s *StdinPiper) Write(bytes []byte)

type Step

type Step struct {
	Name string
	Path string
}

func Load

func Load(name string) (*Step, error)

func (*Step) Command

func (s *Step) Command() *exec.Cmd

type StepDoesNotExist

type StepDoesNotExist struct {
	Name    string
	Message string
}

func (StepDoesNotExist) Error

func (sdne StepDoesNotExist) Error() string

type StepHandler

type StepHandler func(corkDir string, executor *StepsExecutor, stream streamer.StepStream, step *definition.Step) (map[string]string, error)

StepHandler - Handles steps

type StepInvalid

type StepInvalid struct {
	Name    string
	Message string
}

func (StepInvalid) Error

func (si StepInvalid) Error() string

type StepRunner added in v0.2.0

type StepRunner interface {
	Initialize(params StepRunnerParams) error
	Run()
	HandleInput(bytes []byte) error
	HandleSignal(signal int32) error
}

func CommandStepRunnerFactory added in v0.2.0

func CommandStepRunnerFactory(params StepRunnerParams) (StepRunner, error)

func ExportStepRunnerFactory added in v0.2.0

func ExportStepRunnerFactory(params StepRunnerParams) (StepRunner, error)

type StepRunnerFactory added in v0.2.0

type StepRunnerFactory func(params StepRunnerParams) (StepRunner, error)

type StepRunnerParams added in v0.2.0

type StepRunnerParams struct {
	Context   ExecContext
	Args      *definition.StepArgs
	Stream    streamer.StepStream
	ErrorChan chan error
	DoneChan  chan bool
}

type StepRunnersMap added in v0.2.0

type StepRunnersMap map[string]StepRunnerFactory
var StepRunners StepRunnersMap

func (StepRunnersMap) GetRunner added in v0.2.0

func (s StepRunnersMap) GetRunner(name string, params StepRunnerParams) (StepRunner, error)

type StepsExecutor

type StepsExecutor struct {
	Renderer       *definition.CorkTemplateRenderer
	CorkDir        string
	Stream         streamer.StepStream
	Steps          []*definition.Step
	InputChan      chan *pb.ExecuteInputEvent
	InputErrorChan chan error
	InputWait      chan bool
}

func NewExecutor

func NewExecutor(corkDir string, renderer *definition.CorkTemplateRenderer, stream streamer.StepStream, steps []*definition.Step) *StepsExecutor

func (*StepsExecutor) AddOutput

func (se *StepsExecutor) AddOutput(stepName string, varName string, value string)

func (*StepsExecutor) Execute added in v0.2.0

func (se *StepsExecutor) Execute() error

func (*StepsExecutor) ExecuteStep

func (se *StepsExecutor) ExecuteStep(step *definition.Step) error

Jump to

Keyboard shortcuts

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