runtimes

package
Version: v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const BuildkitName = "buildkit"
View Source
const Ext = ".bass"

Ext is the canonical file extension for Bass source code.

View Source
const NoExt = ""

Variables

This section is empty.

Functions

func Init

func Init(name string, pool bass.RuntimePool, config *bass.Scope) (bass.Runtime, error)

Init initializes the runtime registered under the given name.

func NewBass

func NewBass(pool bass.RuntimePool) bass.Runtime

func NewBuildkit

func NewBuildkit(_ bass.RuntimePool, cfg *bass.Scope) (bass.Runtime, error)

func NewScope

func NewScope(parent *bass.Scope, state RunState) *bass.Scope

func RegisterRuntime

func RegisterRuntime(name string, init InitFunc)

Register installs a runtime under a given name.

It should be called in a runtime's init() function with the runtime's constructor.

func RunTest

func RunTest(ctx context.Context, t *testing.T, pool bass.RuntimePool, file string, env *bass.Scope) (bass.Value, error)

func Suite

func Suite(t *testing.T, pool bass.RuntimePool)

Types

type Assoc

type Assoc struct {
	Platform bass.Platform
	Runtime  bass.Runtime
}

Assoc associates a platform to a runtime.

type Bass

type Bass struct {
	External bass.RuntimePool
	// contains filtered or unexported fields
}

func (*Bass) Export

func (runtime *Bass) Export(ctx context.Context, w io.Writer, thunk bass.Thunk) error

func (*Bass) ExportPath

func (runtime *Bass) ExportPath(ctx context.Context, w io.Writer, path bass.ThunkPath) error

func (*Bass) Load

func (runtime *Bass) Load(ctx context.Context, thunk bass.Thunk) (*bass.Scope, error)

func (*Bass) Prune

func (runtime *Bass) Prune(ctx context.Context, opts bass.PruneOpts) error

func (*Bass) Resolve

func (runtime *Bass) Resolve(ctx context.Context, ref bass.ThunkImageRef) (bass.ThunkImageRef, error)

func (*Bass) Run

func (runtime *Bass) Run(ctx context.Context, w io.Writer, thunk bass.Thunk) error

type Buildkit

type Buildkit struct {
	Config   BuildkitConfig
	Client   *kitdclient.Client
	Platform ocispecs.Platform
}

func (*Buildkit) Export

func (runtime *Buildkit) Export(ctx context.Context, w io.Writer, thunk bass.Thunk) error

func (*Buildkit) ExportPath

func (runtime *Buildkit) ExportPath(ctx context.Context, w io.Writer, tp bass.ThunkPath) error

func (*Buildkit) Load

func (runtime *Buildkit) Load(ctx context.Context, thunk bass.Thunk) (*bass.Scope, error)

func (*Buildkit) Prune

func (runtime *Buildkit) Prune(ctx context.Context, opts bass.PruneOpts) error

func (*Buildkit) Resolve

func (runtime *Buildkit) Resolve(ctx context.Context, imageRef bass.ThunkImageRef) (bass.ThunkImageRef, error)

func (*Buildkit) Run

func (runtime *Buildkit) Run(ctx context.Context, w io.Writer, thunk bass.Thunk) error

type BuildkitConfig

type BuildkitConfig struct {
	BuildkitAddr string `json:"buildkit_addr,omitempty"`
	Data         string `json:"data,omitempty"`
	DisableCache bool   `json:"disable_cache,omitempty"`
}

func (BuildkitConfig) Cleanup

func (config BuildkitConfig) Cleanup(id string) error

func (BuildkitConfig) ResponseDir

func (config BuildkitConfig) ResponseDir(id string) string

func (BuildkitConfig) ResponsePath

func (config BuildkitConfig) ResponsePath(id string) string

type Command

type Command struct {
	Args  []string `json:"args"`
	Stdin []byte   `json:"stdin"`
	Env   []string `json:"env"`
	Dir   *string  `json:"dir"`

	Mounts []CommandMount `json:"-"` // doesn't need to be marshaled
	// contains filtered or unexported fields
}

Command is a helper type constructed by a runtime by Resolving a Thunk.

It contains the direct values to be provided for the process running in the container.

func NewCommand

func NewCommand(thunk bass.Thunk) (Command, error)

Resolve traverses the Thunk, resolving logical path values to their concrete paths in the container, and collecting the requisite mount points along the way.

func (Command) Equal

func (cmd Command) Equal(other Command) bool

type CommandMount

type CommandMount struct {
	Source bass.ThunkMountSource
	Target string
}

CommandMount configures a thunk path to mount to the command's container.

type InitFunc

type InitFunc func(bass.RuntimePool, *bass.Scope) (bass.Runtime, error)

InitFunc is a Runtime constructor.

type NoRuntimeError

type NoRuntimeError struct {
	Platform bass.Platform
}

NoRuntimeError is returned when a platform has no runtime associated to it.

func (NoRuntimeError) Error

func (err NoRuntimeError) Error() string

type Pool

type Pool struct {
	Bass     bass.Runtime
	Runtimes []Assoc
}

Pool is the full set of platform <-> runtime pairs configured by the user.

func NewPool

func NewPool(config *bass.Config) (*Pool, error)

NewPool initializes all runtimes in the given configuration.

func (*Pool) All

func (pool *Pool) All() []bass.Runtime

All returns all available runtimes.

func (*Pool) Select

func (pool *Pool) Select(platform *bass.Platform) (bass.Runtime, error)

Select chooses a runtime appropriate for the requested platform.

type RunState

type RunState struct {
	Dir    bass.Path
	Env    *bass.Scope
	Stdin  *bass.Source
	Stdout *bass.Sink
}

type StrThunk

type StrThunk struct {
	Values bass.List `json:"str"`
}

StrThunk contains a list of values to be resolved to strings and concatenated together to form a single string.

It is used to concatenate path thunks with literal strings.

type UnknownRuntimeError

type UnknownRuntimeError struct {
	Name string
}

UnknownRuntimeError is returned when an unknown runtime is configured.

func (UnknownRuntimeError) Error

func (err UnknownRuntimeError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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