platform

package
v0.0.0-...-8e6cb86 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, executor Executor, entrypoint Entrypoint, tmpDir string, o ExecOptions, shell bool) error

func HasAllLabels

func HasAllLabels(required, candidate map[string]string) bool

HasAllLabels checks if candidate has all labels from required

func HasHostFsAccess

func HasHostFsAccess(p Executor) bool

func IsLocalExecutor

func IsLocalExecutor(p Executor) bool

func RegisterProvider

func RegisterProvider(name string, factory ProviderFactory)

func RenderInitFile

func RenderInitFile(cmds string) (string, error)

Types

type Entrypoint

type Entrypoint interface {
	EntrypointExec
	ShellEntrypoint(initfile string) (EntrypointExec, error)
	ShellPrint(args []string) string
}
var BashEntrypoint Entrypoint = bashEntrypoint{}
var ExecEntrypoint Entrypoint = execEntrypoint{}
var ShEntrypoint Entrypoint = shEntrypoint{}

type EntrypointContext

type EntrypointContext struct {
	Args    []string
	CmdArgs []string // args coming from the terminal
	Env     map[string]string
}

type EntrypointExec

type EntrypointExec interface {
	ExecArgs(ctx EntrypointContext) ([]string, error)
}

func NewInteractiveEntrypoint

func NewInteractiveEntrypoint(tmpDir, cmds string, entrypoint Entrypoint) (EntrypointExec, func(), error)

type ExecOptions

type ExecOptions struct {
	WorkDir  string
	BinDir   string
	HomeDir  string
	Target   specs.Target
	Env      map[string]string
	Run      []string
	TermArgs []string
	IOCfg    sandbox.IOConfig
}

type Executor

type Executor interface {
	Exec(ctx context.Context, o ExecOptions, execArgs []string) error
	Os() string
	Arch() string
}

func NewDockerExecutor

func NewDockerExecutor(exe, os, arch, image string, mountsMap map[string]string, args []string) Executor

func NewLocalExecutor

func NewLocalExecutor() Executor

type PlatformProvider

type PlatformProvider struct {
	config.Platform
	Provider
}

func Bootstrap

func Bootstrap(cfg *config.Config) []PlatformProvider

type Provider

type Provider interface {
	NewExecutor(labels map[string]string, options map[string]interface{}) (Executor, error)
}

func GetProvider

func GetProvider(provider, name string, options map[string]interface{}) (Provider, error)

func NewDockerProvider

func NewDockerProvider(name string, options map[string]interface{}) (Provider, error)

func NewLocalProvider

func NewLocalProvider(name string) Provider

type ProviderFactory

type ProviderFactory func(name string, options map[string]interface{}) (Provider, error)

Jump to

Keyboard shortcuts

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