worker

package
v0.0.0-...-3b05df2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(spec *Workflow)

func EnvToSlice

func EnvToSlice(envMap map[string]string) []string

func IsRestrictedVolume

func IsRestrictedVolume(path string) bool

IsRestrictedVolume is a helper function that returns true if mounting the volume is restricted for untrusted containers.

func Run

func Run(ctx context.Context, client clients.WorkerV1, hook Hook) error

Types

type Hook

type Hook interface {
	Begin(ctx context.Context, spec *Workflow) error
	End(ctx context.Context, spec *Workflow) error
	Step(ctx context.Context, spec *Workflow, step *Step, writer io.Writer) (*State, error)
}

type State

type State struct {
	ExitCode  int
	OOMKilled bool
}

type Step

type Step struct {
	ID              string
	Name            string
	Image           string
	ImagePullPolicy v1.PullPolicy
	ImagePullAuth   string
	Privileged      bool
	WorkingDir      string
	Network         string
	Env             map[string]string
	DNS             []string
	DNSSearch       []string
	ExtraHosts      []string
	Entrypoint      []string
	Shell           []string
	Command         []string
	Args            []string
	VolumeMounts    []v1.VolumeMount
	Devices         []v1.VolumeDevice
}

func (*Step) CombineEnv

func (s *Step) CombineEnv(env ...any) map[string]string

type Volume

type Volume struct {
	v1.Volume

	ID string
}

type VolumeDevice

type VolumeDevice struct {
	Name string
	Path string
}

type Worker

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

func New

func New(client clients.Worker, hook Hook, log *wslog.Logger, count int) (*Worker, error)

func NewMust

func NewMust(client clients.Worker, hook Hook, log *wslog.Logger, count int) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

type Workflow

type Workflow struct {
	ID        string
	Name      string
	Namespace string
	Labels    map[string]string

	Steps       []*Step
	WorkingDir  string
	Concurrency int
	Volumes     []Volume
	DependsOn   []string
	Worker      *v1.Worker
}

func Convert

func Convert(in *v1.Workflow, status *v1.Stage, secrets []*v1.Secret) (*Workflow, error)

func (*Workflow) GetStep

func (s *Workflow) GetStep(name string) *Step

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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