engine

package
v0.0.0-...-4c964c4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth defines dockerhub authentication credentials.

type Docker

type Docker struct {
	// contains filtered or unexported fields
}

Docker implements a Docker pipeline engine.

func New

func New(client client.APIClient, opts Opts) *Docker

New returns a new engine.

func NewEnv

func NewEnv(opts Opts) (*Docker, error)

NewEnv returns a new Engine from the environment.

func (*Docker) Destroy

func (e *Docker) Destroy(ctx context.Context, spec *Spec) error

Destroy the pipeline environment.

func (*Docker) Ping

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

Ping pings the Docker daemon.

func (*Docker) Run

func (e *Docker) Run(ctx context.Context, spec *Spec, step *Step, output io.Writer) (*State, error)

Run runs the pipeline step.

func (*Docker) Setup

func (e *Docker) Setup(ctx context.Context, spec *Spec) error

Setup the pipeline environment.

type Engine

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

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

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

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

type ErrPolicy

type ErrPolicy int

ErrPolicy defines the step error policy

const (
	ErrFail ErrPolicy = iota
	ErrFailFast
	ErrIgnore
)

ErrPolicy enumeration.

func (*ErrPolicy) MarshalJSON

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

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

func (ErrPolicy) String

func (p ErrPolicy) String() string

func (*ErrPolicy) UnmarshalJSON

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

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

type Network

type Network struct {
	ID      string            `json:"id,omitempty"`
	Labels  map[string]string `json:"labels,omitempty"`
	Options map[string]string `json:"options,omitempty"`
}

Network that is created and attached to containers

type Opts

type Opts struct {
	HidePull bool
}

Opts configures the Docker engine.

type Platform

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

Platform defines the target platform.

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 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 {
	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 {
	Platform Platform  `json:"platform,omitempty"`
	Steps    []*Step   `json:"steps,omitempty"`
	Internal []*Step   `json:"internal,omitempty"`
	Volumes  []*Volume `json:"volumes,omitempty"`
	Network  Network   `json:"network"`
}

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

type State

type State struct {
	// ExitCode returns the exit code of the exited step.
	ExitCode int

	// GetExited reports whether the step has exited.
	Exited bool

	// OOMKilled reports whether the step has been
	// killed by the process manager.
	OOMKilled bool
}

State reports the execution state.

type Step

type Step struct {
	ID           string            `json:"id,omitempty"`
	Auth         *Auth             `json:"auth,omitempty"`
	Command      []string          `json:"args,omitempty"`
	CPUPeriod    int64             `json:"cpu_period,omitempty"`
	CPUQuota     int64             `json:"cpu_quota,omitempty"`
	CPUShares    int64             `json:"cpu_shares,omitempty"`
	CPUSet       []string          `json:"cpu_set,omitempty"`
	Detach       bool              `json:"detach,omitempty"`
	DependsOn    []string          `json:"depends_on,omitempty"`
	Devices      []*VolumeDevice   `json:"devices,omitempty"`
	DNS          []string          `json:"dns,omitempty"`
	DNSSearch    []string          `json:"dns_search,omitempty"`
	Entrypoint   []string          `json:"entrypoint,omitempty"`
	Envs         map[string]string `json:"environment,omitempty"`
	ErrPolicy    ErrPolicy         `json:"err_policy,omitempty"`
	ExtraHosts   []string          `json:"extra_hosts,omitempty"`
	IgnoreStdout bool              `json:"ignore_stderr,omitempty"`
	IgnoreStderr bool              `json:"ignore_stdout,omitempty"`
	Image        string            `json:"image,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	MemSwapLimit int64             `json:"memswap_limit,omitempty"`
	MemLimit     int64             `json:"mem_limit,omitempty"`
	Name         string            `json:"name,omitempty"`
	Network      string            `json:"network,omitempty"`
	Networks     []string          `json:"networks,omitempty"`
	Privileged   bool              `json:"privileged,omitempty"`
	Pull         PullPolicy        `json:"pull,omitempty"`
	RunPolicy    RunPolicy         `json:"run_policy,omitempty"`
	Secrets      []*Secret         `json:"secrets,omitempty"`
	ShmSize      int64             `json:"shm_size,omitempty"`
	User         string            `json:"user,omitempty"`
	Volumes      []*VolumeMount    `json:"volumes,omitempty"`
	WorkingDir   string            `json:"working_dir,omitempty"`

	Display string
}

Step defines a pipeline step.

type Volume

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

Volume that can be mounted by containers.

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 {
	ID        string            `json:"id,omitempty"`
	Name      string            `json:"name,omitempty"`
	Medium    string            `json:"medium,omitempty"`
	SizeLimit int64             `json:"size_limit,omitempty"`
	Labels    map[string]string `json:"labels,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 {
	ID       string            `json:"id,omitempty"`
	Name     string            `json:"name,omitempty"`
	Path     string            `json:"path,omitempty"`
	Labels   map[string]string `json:"labels,omitempty"`
	ReadOnly bool              `json:"read_only,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.

Jump to

Keyboard shortcuts

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