executor

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineStageStatus

func DetermineStageStatus(sig StopSignalType, ori, got model.StageStatus) model.StageStatus

func NewStopSignal

func NewStopSignal() (StopSignal, StopSignalHandler)

Types

type CommandLister

type CommandLister interface {
	ListCommands() []model.ReportableCommand
}

type Executor

type Executor interface {
	// Execute starts running executor until completion
	// or the StopSignal has emitted.
	Execute(sig StopSignal) model.StageStatus
}

type Factory

type Factory func(in Input) Executor

type Input

type Input struct {
	Stage       *model.PipelineStage
	StageConfig config.PipelineStage
	// Readonly deployment model.
	Deployment       *model.Deployment
	DeploymentConfig *config.Config
	PipedConfig      *config.PipedSpec
	Application      *model.Application
	WorkingDir       string
	// The path to the directory containing repository's source code at target commit.
	RepoDir string
	// The path to the directory containing repository's source code at running commit.
	// This directory is valid only when the Deployment.RunningCommitHash is not empty.
	RunningRepoDir    string
	StageWorkingDir   string
	CommandLister     CommandLister
	LogPersister      LogPersister
	MetadataStore     MetadataStore
	AppManifestsCache cache.Cache
	Logger            *zap.Logger
}

type LogPersister

type LogPersister interface {
	Append(log string, s model.LogSeverity)
	AppendInfo(log string)
	AppendSuccess(log string)
	AppendError(log string)
}

type MetadataStore

type MetadataStore interface {
	Get(key string) (string, bool)
	Set(ctx context.Context, key, value string) error

	GetStageMetadata(stageID string) (map[string]string, bool)
	SetStageMetadata(ctx context.Context, stageID string, metadata map[string]string) error
}

type StopSignal

type StopSignal interface {
	Context() context.Context
	Ch() <-chan StopSignalType
	Signal() StopSignalType
	Stopped() bool
}

type StopSignalHandler

type StopSignalHandler interface {
	Cancel()
	Timeout()
	Terminate()
}

type StopSignalType

type StopSignalType string
const (
	// StopSignalTerminate means the executor should stop its execution
	// because the program was asked to terminate.
	StopSignalTerminate StopSignalType = "terminate"
	// StopSignalCancel means the executor should stop its execution
	// because the deployment was cancelled.
	StopSignalCancel StopSignalType = "cancel"
	// StopSignalTimeout means the executor should stop its execution
	// because of timeout.
	StopSignalTimeout StopSignalType = "timeout"
	// StopSignalNone means the excutor can be continuously executed.
	StopSignalNone StopSignalType = "none"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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