engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: BlueOak-1.0.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BOOT_MAX_DELAY time.Duration = 3 * time.Minute

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	ImageDir            string
	TempDir             string
	MachineConfig       MachineConfig
	Image               string
	SshPort             int
	QemuProcess         *os.Process
	QemuProcessExitChan chan struct{}
}

Engine implements a pipeline engine.

func New

func New(opts Opts) (*Engine, error)

New returns a new engine.

func (*Engine) Destroy

func (e *Engine) Destroy(ctx context.Context, specv runtime.Spec) error

Destroy the pipeline environment.

func (*Engine) Ping

func (e *Engine) Ping(ctx context.Context) error

Ping pings the underlying runtime to verify connectivity.

func (*Engine) Run

func (e *Engine) Run(ctx context.Context, specv runtime.Spec, stepv runtime.Step, output io.Writer) (*runtime.State, error)

Run runs the pipeline step.

func (*Engine) Setup

func (e *Engine) Setup(ctx context.Context, specv runtime.Spec) error

Setup the pipeline environment.

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.

func (*File) String

func (f *File) String() string

type MachineConfig

type MachineConfig struct {
	Username        string `json:"username,omitempty"`
	BaseImage       string `json:"base_image,omitempty"`
	BaseImageFormat string `json:"base_image_format,omitempty"`
}

Machine configuration, loaded from JSON

type Opts

type Opts struct {
	ImageDir string
	TempDir  string
}

Opts configures the Engine.

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.

func (*Secret) GetName

func (s *Secret) GetName() string

func (*Secret) GetValue

func (s *Secret) GetValue() string

func (*Secret) IsMasked

func (s *Secret) IsMasked() bool

type Settings

type Settings struct {
	Image string `json:"image,omitempty"`
}

Settings provides pipeline settings.

type Spec

type Spec struct {
	Root     string   `json:"root,omitempty"`
	Settings Settings `json:"settings,omitempty"`
	Files    []*File  `json:"files,omitempty"`
	Steps    []*Step  `json:"steps,omitempty"`
}

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

func (*Spec) StepAt

func (s *Spec) StepAt(i int) runtime.Step

func (*Spec) StepLen

func (s *Spec) StepLen() int

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"`
	ErrPolicy  runtime.ErrPolicy `json:"err_policy,omitempty"`
	Envs       map[string]string `json:"environment,omitempty"`
	Files      []*File           `json:"files,omitempty"`
	Name       string            `json:"name,omitempt"`
	RunPolicy  runtime.RunPolicy `json:"run_policy,omitempty"`
	Secrets    []*Secret         `json:"secrets,omitempty"`
	WorkingDir string            `json:"working_dir,omitempty"`
}

Step defines a pipeline step.

func (*Step) Clone

func (s *Step) Clone() runtime.Step

func (*Step) GetDependencies

func (s *Step) GetDependencies() []string

func (*Step) GetEnviron

func (s *Step) GetEnviron() map[string]string

func (*Step) GetErrPolicy

func (s *Step) GetErrPolicy() runtime.ErrPolicy

func (*Step) GetName

func (s *Step) GetName() string

func (*Step) GetRunPolicy

func (s *Step) GetRunPolicy() runtime.RunPolicy

func (*Step) GetSecretAt

func (s *Step) GetSecretAt(i int) runtime.Secret

func (*Step) GetSecretLen

func (s *Step) GetSecretLen() int

func (*Step) IsDetached

func (s *Step) IsDetached() bool

func (*Step) SetEnviron

func (s *Step) SetEnviron(env map[string]string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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