engine

package
v0.0.0-...-cb2ea0e Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Setup the pipeline environment.
	Setup(context.Context, *Spec) error

	// Run runs the pipeine step.
	Run(context.Context, *Spec, *Step, io.Writer) (*State, error)

	// Create creates the pipeline state.
	Create(context.Context, *Spec, *Step) error

	// Start the pipeline step.
	Start(context.Context, *Spec, *Step) error

	// Wait for the pipeline step to complete and returns the completion results.
	Wait(context.Context, *Spec, *Step) (*State, error)

	// Tail the pipeline step logs.
	Tail(context.Context, *Spec, *Step) (io.ReadCloser, error)

	// Destroy the pipeline environment.
	Destroy(context.Context, *Spec) error
}

Engine is the interface that must be implemented by a pipeline execution engine.

func New

func New() Engine

New returns a new engine.

type File

type File struct {
	Path  string `json:"path,omitempty"`
	Mode  uint32 `json:"mode,omitempty"`
	Data  []byte `json:"data,omitempty"`
	IsDir bool   `json:"is_dir,omitempty"`
}

File defines a file that should be uploaded or mounted somewhere in the step container or virtual machine prior to command execution.

type Platform

type Platform struct {
	OS      string `json:"os,omitempty"`
	Arch    string `json:"arch,omitempty"`
	Variant string `json:"variant,omitempty"`
	Version string `json:"version,omitempty"`
}

Platform defines the target platform.

type RunPolicy

type RunPolicy int

RunPolicy defines the policy for starting containers based on the point-in-time pass or fail state of the pipeline.

const (
	RunOnSuccess RunPolicy = iota
	RunOnFailure
	RunAlways
	RunNever
)

RunPolicy enumeration.

type Secret

type Secret struct {
	Name string `json:"name,omitempty"`
	Env  string `json:"env,omitempty"`
	Data []byte `json:"data,omitempty"`
	Mask bool   `json:"mask,omitempty"`
}

Secret represents a secret variable.

type Spec

type Spec struct {
	// Metadata Metadata  `json:"metadata,omitempty"`
	Platform Platform `json:"platform,omitempty"`
	Root     string   `json:"root,omitempty"`
	Files    []*File  `json:"files,omitempty"`
	Steps    []*Step  `json:"steps,omitempty"`
}

Spec provides the pipeline spec. This provides the required instructions for reproducable pipeline execution.

type State

type State struct {
	ExitCode  int  // Container exit code
	Exited    bool // Container exited
	OOMKilled bool // Container is oom killed
}

State represents the process state.

type Step

type Step struct {
	Args         []string          `json:"args,omitempty"`
	Command      string            `json:"command,omitempty"`
	Detach       bool              `json:"detach,omitempty"`
	DependsOn    []string          `json:"depends_on,omitempty"`
	Envs         map[string]string `json:"environment,omitempty"`
	Files        []*File           `json:"files,omitempty"`
	IgnoreErr    bool              `json:"ignore_err,omitempty"`
	IgnoreStdout bool              `json:"ignore_stderr,omitempty"`
	IgnoreStderr bool              `json:"ignore_stdout,omitempty"`
	Name         string            `json:"name,omitempt"`
	RunPolicy    RunPolicy         `json:"run_policy,omitempty"`
	Secrets      []*Secret         `json:"secrets,omitempty"`
	WorkingDir   string            `json:"working_dir,omitempty"`
}

Step defines a pipeline step.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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