engine

package
v0.0.0-...-e99cc0b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerAuth

type DockerAuth struct {
	Address  string `json:"address,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

DockerAuth defines dockerhub authentication credentials.

func LookupAuth

func LookupAuth(spec *Spec, domain string) (*DockerAuth, bool)

LookupAuth is a helper function that will lookup the docker credentials by hostname.

type DockerConfig

type DockerConfig struct {
	Auths   []*DockerAuth `json:"auths,omitempty"`
	Volumes []*Volume     `json:"volumes,omitempty"`
}

DockerConfig configures a Docker-based pipeline.

type DockerStep

type DockerStep struct {
	Args       []string   `json:"args,omitempty"`
	Command    []string   `json:"command,omitempty"`
	DNS        []string   `json:"dns,omitempty"`
	DNSSearch  []string   `json:"dns_search,omitempty"`
	ExtraHosts []string   `json:"extra_hosts,omitempty"`
	Image      string     `json:"image,omitempty"`
	Network    string     `json:"network,omitempty"`
	Networks   []string   `json:"networks,omitempty"`
	Ports      []*Port    `json:"ports,omitempty"`
	Privileged bool       `json:"privileged,omitempty"`
	PullPolicy PullPolicy `json:"pull_policy,omitempty"`
	User       string     `json:"user"`
}

DockerStep configures a docker step.

type Engine

type Engine interface {
	// Setup the pipeline environment.
	Setup(context.Context, *Spec) 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 defines a runtime engine for pipeline execution.

type File

type File struct {
	Metadata Metadata `json:"metadata,omitempty"`
	Data     []byte   `json:"data,omitempty"`
}

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

func LookupFile

func LookupFile(spec *Spec, name string) (*File, bool)

LookupFile is a helper function that will lookup the named file.

type FileMount

type FileMount struct {
	Name string `json:"name,omitempty"`
	Path string `json:"path,omitempty"`
	Mode int64  `json:"mode,omitempty"`
}

FileMount defines how a file resource should be mounted or included in the runtime environment.

type FusionConfig

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

FusionConfig configures a VMWare Fusion-based pipeline.

type Metadata

type Metadata struct {
	UID       string            `json:"uid,omitempty"`
	Namespace string            `json:"namespace,omitempty"`
	Name      string            `json:"name,omitempty"`
	Labels    map[string]string `json:"labels,omitempty"`
}

Metadata provides execution metadata.

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 Port

type Port struct {
	Port     int    `json:"port,omitempty"`
	Host     int    `json:"host,omitempty"`
	Protocol string `json:"protocol,omitempty"`
}

Port represents a network port in a single container.

type PullPolicy

type PullPolicy int

PullPolicy defines the container image pull policy.

const (
	PullDefault PullPolicy = iota
	PullAlways
	PullIfNotExists
	PullNever
)

PullPolicy enumeration.

func (*PullPolicy) MarshalJSON

func (p *PullPolicy) MarshalJSON() ([]byte, error)

MarshalJSON marshals the string representation of the pull type to JSON.

func (PullPolicy) String

func (p PullPolicy) String() string

func (*PullPolicy) UnmarshalJSON

func (p *PullPolicy) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the json representation of the pull type from a string value.

type QemuConfig

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

QemuConfig configures a Qemu-based pipeline.

type ResourceObject

type ResourceObject struct {
	CPU    int64 `json:"cpu,omitempty"`
	Memory int64 `json:"memory,omitempty"`
}

ResourceObject describes compute resource requirements.

type Resources

type Resources struct {
	// Limits describes the maximum amount of compute
	// resources allowed.
	Limits *ResourceObject `json:"limits,omitempty"`

	// Requests describes the minimum amount of
	// compute resources required.
	Requests *ResourceObject `json:"requests,omitempty"`
}

Resources describes the compute resource requirements.

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.

func (*RunPolicy) MarshalJSON

func (r *RunPolicy) MarshalJSON() ([]byte, error)

MarshalJSON marshals the string representation of the run type to JSON.

func (RunPolicy) String

func (r RunPolicy) String() string

func (*RunPolicy) UnmarshalJSON

func (r *RunPolicy) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the json representation of the run type from a string value.

type Secret

type Secret struct {
	Metadata Metadata `json:"metadata,omitempty"`
	Data     string   `json:"data,omitempty"`
}

Secret represents a secret variable.

func LookupSecret

func LookupSecret(spec *Spec, secret *SecretVar) (*Secret, bool)

LookupSecret is a helper function that will lookup the named secret.

type SecretVar

type SecretVar struct {
	Name string `json:"name,omitempty"`
	Env  string `json:"env,omitempty"`
}

SecretVar represents an environment variable sources from a secret.

type Spec

type Spec struct {
	Metadata Metadata  `json:"metadata,omitempty"`
	Platform Platform  `json:"platform,omitempty"`
	Secrets  []*Secret `json:"secrets,omitempty"`
	Steps    []*Step   `json:"steps,omitempty"`
	Files    []*File   `json:"files,omitempty"`

	// Docker-specific settings. These settings are
	// only used by the Docker and Kubernetes runtime
	// drivers.
	Docker *DockerConfig `json:"docker,omitempty"`

	// Qemu-specific settings. These settings are only
	// used by the qemu runtime driver.
	Qemu *QemuConfig `json:"qemu,omitempty"`

	// VMWare Fusion settings. These settings are only
	// used by the VMWare runtime driver.
	Fusion *FusionConfig `json:"fusion,omitempty"`
}

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

func Parse

func Parse(r io.Reader) (*Spec, error)

Parse parses the pipeline config from an io.Reader.

func ParseFile

func ParseFile(path string) (*Spec, error)

ParseFile parses the pipeline config from a file.

func ParseString

func ParseString(s string) (*Spec, error)

ParseString parses the pipeline config from a string.

type State

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

State represents the container state.

type Step

type Step struct {
	Metadata     Metadata          `json:"metadata,omitempty"`
	Detach       bool              `json:"detach,omitempty"`
	DependsOn    []string          `json:"depends_on,omitempty"`
	Devices      []*VolumeDevice   `json:"devices,omitempty"`
	Envs         map[string]string `json:"environment,omitempty"`
	Files        []*FileMount      `json:"files,omitempty"`
	IgnoreErr    bool              `json:"ignore_err,omitempty"`
	IgnoreStdout bool              `json:"ignore_stderr,omitempty"`
	IgnoreStderr bool              `json:"ignore_stdout,omitempty"`
	Resources    *Resources        `json:"resources,omitempty"`
	RunPolicy    RunPolicy         `json:"run_policy,omitempty"`
	Secrets      []*SecretVar      `json:"secrets,omitempty"`
	Volumes      []*VolumeMount    `json:"volumes,omitempty"`
	WorkingDir   string            `json:"working_dir,omitempty"`

	// Docker-specific settings. These settings are
	// only used by the Docker and Kubernetes runtime
	// drivers.
	Docker *DockerStep `json:"docker,omitempty"`
}

Step defines a pipeline step.

type Volume

type Volume struct {
	Metadata Metadata        `json:"metadata,omitempty"`
	EmptyDir *VolumeEmptyDir `json:"temp,omitempty"`
	HostPath *VolumeHostPath `json:"host,omitempty"`
}

Volume that can be mounted by containers.

func LookupVolume

func LookupVolume(spec *Spec, name string) (*Volume, bool)

LookupVolume is a helper function that will lookup the named volume.

type VolumeDevice

type VolumeDevice struct {
	Name       string `json:"name,omitempty"`
	DevicePath string `json:"path,omitempty"`
}

VolumeDevice describes a mapping of a raw block device within a container.

type VolumeEmptyDir

type VolumeEmptyDir struct {
	Medium    string `json:"medium,omitempty"`
	SizeLimit int64  `json:"size_limit,omitempty"`
}

VolumeEmptyDir mounts a temporary directory from the host node's filesystem into the container. This can be used as a shared scratch space.

type VolumeHostPath

type VolumeHostPath struct {
	Path string `json:"path,omitempty"`
}

VolumeHostPath mounts a file or directory from the host node's filesystem into your container.

type VolumeMount

type VolumeMount struct {
	Name string `json:"name,omitempty"`
	Path string `json:"path,omitempty"`
}

VolumeMount describes a mounting of a Volume within a container.

Directories

Path Synopsis
Package mock_engine is a generated GoMock package.
Package mock_engine is a generated GoMock package.

Jump to

Keyboard shortcuts

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