runtimes

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 81 Imported by: 1

Documentation

Index

Constants

View Source
const BuildkitName = "buildkit"
View Source
const DaggerName = "dagger"
View Source
const DefaultBuildkitInstallation = "bass-buildkitd"
View Source
const GRPCName = "grpc"
View Source
const RuntimeServiceName = "runtime"

RuntimeServiceName is the name given to the forwarded Unix socket that forwards the runtime GRPC service.

Variables

View Source
var ErrKeepaliveTimeout = errors.New("client->server keepalive ping timed out")

ErrKeepaliveTimeout is returned when the keepalive loop tries to send a keepalive request but takes too long, indicating a stuck/dead connection.

Functions

func Init

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

Init initializes the runtime registered under the given name.

func NewBuilder added in v0.12.0

func NewBuilder(
	client gwclient.Client,
	platform ocispecs.Platform,
	inputs map[string]llb.State,
	certsDir string,
	secrets *secretStore,
	ociStore content.Store,
	debug, disableCache bool,
) *buildkitBuilder

func NewBuildkit

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

func NewClient added in v0.12.0

func NewClient(ctx context.Context, _ bass.RuntimePool, cfg *bass.Scope) (bass.Runtime, error)

func NewDagger added in v0.11.0

func NewDagger(ctx context.Context, _ bass.RuntimePool, cfg *bass.Scope) (bass.Runtime, error)

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 Suite

func Suite(t *testing.T, runtimeConfig bass.RuntimeConfig, opts ...SuiteOpt)

Types

type AnyDirSource added in v0.12.0

type AnyDirSource struct{}

func (AnyDirSource) LookupDir added in v0.12.0

func (AnyDirSource) LookupDir(name string) (filesync.SyncedDir, bool)

type Assoc

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

Assoc associates a platform to a runtime.

type Buildkit

type Buildkit struct {
	Config   BuildkitConfig
	Platform ocispecs.Platform
	Inputs   map[string]llb.State
	// contains filtered or unexported fields
}

func NewBuildkitFrontend added in v0.12.0

func NewBuildkitFrontend(gw gwclient.Client, inputs map[string]llb.State, config BuildkitConfig) (*Buildkit, error)

func (*Buildkit) Client

func (buildkit *Buildkit) Client() (*bkclient.Client, error)

func (*Buildkit) Close added in v0.6.0

func (runtime *Buildkit) Close() error

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) NewBuilder added in v0.12.0

func (runtime *Buildkit) NewBuilder(ctx context.Context, client gwclient.Client) *buildkitBuilder

func (*Buildkit) Prune

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

func (*Buildkit) Publish added in v0.12.0

func (runtime *Buildkit) Publish(ctx context.Context, ref bass.ImageRef, thunk bass.Thunk) (bass.ImageRef, error)

func (*Buildkit) Read added in v0.6.1

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

func (*Buildkit) Resolve

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

func (*Buildkit) Run

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

func (*Buildkit) Start added in v0.10.0

func (runtime *Buildkit) Start(ctx context.Context, thunk bass.Thunk) (StartResult, error)

func (*Buildkit) WithGateway added in v0.12.0

func (runtime *Buildkit) WithGateway(ctx context.Context, doBuild func(ctx context.Context, gw gwclient.Client) (*gwclient.Result, error)) error

type BuildkitConfig

type BuildkitConfig struct {
	Oneshot      bool   `json:"oneshot,omitempty"`
	Debug        bool   `json:"debug,omitempty"`
	Addr         string `json:"addr,omitempty"`
	Installation string `json:"installation,omitempty"`
	DisableCache bool   `json:"disable_cache,omitempty"`
	CertsDir     string `json:"certs_dir,omitempty"`
	OCIStoreDir  string `json:"oci_store_dir,omitempty"`
}

type Client added in v0.6.0

type Client struct {
	Conn *grpc.ClientConn
	proto.RuntimeClient
}

func (*Client) Close added in v0.6.0

func (client *Client) Close() error

func (*Client) Export added in v0.6.0

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

func (*Client) ExportPath added in v0.6.0

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

func (*Client) Prune added in v0.6.0

func (client *Client) Prune(context.Context, bass.PruneOpts) error

func (*Client) Publish added in v0.12.0

func (client *Client) Publish(ctx context.Context, ref bass.ImageRef, thunk bass.Thunk) (bass.ImageRef, error)

func (*Client) Read added in v0.6.1

func (client *Client) Read(ctx context.Context, w io.Writer, thunk bass.Thunk) error

func (*Client) Resolve added in v0.6.0

func (client *Client) Resolve(ctx context.Context, ref bass.ImageRef) (bass.Thunk, error)

func (*Client) Run added in v0.6.0

func (client *Client) Run(ctx context.Context, thunk bass.Thunk) error

type ClientConfig added in v0.12.0

type ClientConfig struct {
	Target string `json:"target"`
}

type Command

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

	// these don't need to be marshaled, since they're part of the container
	// setup and not passed to the shim
	Mounts    []CommandMount     `json:"-"`
	Services  []bass.Thunk       `json:"-"`
	SecretEnv []CommandSecretEnv `json:"-"`
	// 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(ctx context.Context, starter Starter, 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 CommandHost added in v0.10.0

type CommandHost struct {
	Host   string
	Target net.IP
}

type CommandMount

type CommandMount struct {
	Source bass.ThunkMountSource
	Target string
}

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

type CommandSecretEnv added in v0.12.0

type CommandSecretEnv struct {
	Name   string
	Secret bass.Secret
}

type Dagger added in v0.11.0

type Dagger struct {
	Platform ocispecs.Platform
	// contains filtered or unexported fields
}

func (*Dagger) Close added in v0.11.0

func (runtime *Dagger) Close() error

func (*Dagger) Export added in v0.11.0

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

func (*Dagger) ExportPath added in v0.11.0

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

func (*Dagger) Prune added in v0.11.0

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

func (*Dagger) Publish added in v0.12.0

func (runtime *Dagger) Publish(ctx context.Context, ref bass.ImageRef, thunk bass.Thunk) (bass.ImageRef, error)

func (*Dagger) Read added in v0.11.0

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

func (*Dagger) Resolve added in v0.11.0

func (runtime *Dagger) Resolve(ctx context.Context, imageRef bass.ImageRef) (bass.Thunk, error)

func (*Dagger) Run added in v0.11.0

func (runtime *Dagger) Run(ctx context.Context, thunk bass.Thunk) error

func (*Dagger) Start added in v0.11.0

func (runtime *Dagger) Start(ctx context.Context, thunk bass.Thunk) (StartResult, error)

type DaggerConfig added in v0.11.0

type DaggerConfig struct {
	Host string `json:"host,omitempty"`
}

type InitFunc

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

InitFunc is a Runtime constructor.

type IntermediateBuild added in v0.12.0

type IntermediateBuild struct {
	FS     llb.State
	Exec   llb.ExecState
	Output llb.State

	OutputSourcePath string
	NeedsInsecure    bool

	Platform ocispecs.Platform
	Config   ocispecs.ImageConfig
}

func (IntermediateBuild) ExportFile added in v0.12.0

func (ib IntermediateBuild) ExportFile(ctx context.Context, gw gwclient.Client, tw *tar.Writer, fsp bass.FilePath) (*gwclient.Result, error)

func (IntermediateBuild) ForExportDir added in v0.12.0

func (ib IntermediateBuild) ForExportDir(ctx context.Context, gw gwclient.Client, fsp bass.DirPath) (*gwclient.Result, error)

func (IntermediateBuild) ForPublish added in v0.12.0

func (ib IntermediateBuild) ForPublish(ctx context.Context, gw gwclient.Client) (*gwclient.Result, error)

func (IntermediateBuild) ForRun added in v0.12.0

func (IntermediateBuild) ReadStdout added in v0.12.0

func (ib IntermediateBuild) ReadStdout(ctx context.Context, gw gwclient.Client, w io.Writer) (*gwclient.Result, error)

func (IntermediateBuild) WithImageConfig added in v0.12.0

func (ib IntermediateBuild) WithImageConfig(config []byte) (IntermediateBuild, error)

type NoRuntimeError

type NoRuntimeError struct {
	Platform bass.Platform

	AllRuntimes []Assoc
}

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

func (NoRuntimeError) Error

func (err NoRuntimeError) Error() string

func (NoRuntimeError) NiceError added in v0.7.0

func (err NoRuntimeError) NiceError(w io.Writer, outer error) error

type Pool

type Pool struct {
	Runtimes []Assoc
}

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

func NewPool

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

NewPool initializes all runtimes in the given configuration.

func (*Pool) All

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

All returns all available runtimes.

func (*Pool) Close added in v0.6.0

func (pool *Pool) Close() error

Close closes each runtime.

func (*Pool) Select

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

Select chooses a runtime appropriate for the requested platform.

type PortInfos added in v0.10.0

type PortInfos map[string]*bass.Scope

type SSHClient added in v0.6.0

type SSHClient struct {
	Hosts  []string
	User   string
	Config *ssh.ClientConfig
	// contains filtered or unexported fields
}

SSHClient is a client for forwarding runtimes through a SSH gateway.

func (*SSHClient) Close added in v0.8.0

func (client *SSHClient) Close(ctx context.Context) error

Close closes the internal SSH connection, if any exists.

func (*SSHClient) Dial added in v0.8.0

func (client *SSHClient) Dial(ctx context.Context) error

Dial establishes a connection to the remote SSH server and starts a keepalive loop monitoring the connection's health.

func (*SSHClient) Forward added in v0.6.0

func (client *SSHClient) Forward(ctx context.Context, assoc Assoc) error

Forward opens a SSH tunnel forwarding traffic to/from the given runtime via gRPC.

func (*SSHClient) Wait added in v0.11.0

func (client *SSHClient) Wait() error

Wait waits for all forwarding sessions as well as the keepalive loop. If any of them fail, the rest will be interrupted, and Wait will return.

type Server added in v0.6.0

type Server struct {
	Context context.Context
	Runtime bass.Runtime

	proto.UnimplementedRuntimeServer
}

func (*Server) Export added in v0.6.0

func (srv *Server) Export(p *proto.Thunk, exportSrv proto.Runtime_ExportServer) error

func (*Server) ExportPath added in v0.6.0

func (srv *Server) ExportPath(p *proto.ThunkPath, exportSrv proto.Runtime_ExportPathServer) error

func (*Server) Publish added in v0.12.0

func (srv *Server) Publish(p *proto.PublishRequest, pubSrv proto.Runtime_PublishServer) error

func (*Server) Read added in v0.6.1

func (srv *Server) Read(p *proto.Thunk, readSrv proto.Runtime_ReadServer) error

func (*Server) Resolve added in v0.6.0

func (srv *Server) Resolve(ctx context.Context, p *proto.ImageRef) (*proto.Thunk, error)

func (*Server) Run added in v0.6.0

func (srv *Server) Run(p *proto.Thunk, runSrv proto.Runtime_RunServer) error

type StartResult added in v0.10.0

type StartResult struct {
	// A mapping from each port to its address info (host, port, etc.)
	Ports PortInfos
}

type Starter added in v0.10.0

type Starter interface {
	// Start starts the thunk and waits for its ports to be ready.
	Start(context.Context, bass.Thunk) (StartResult, error)
}

type SuiteConfig added in v0.12.0

type SuiteConfig struct {
	Skip map[string]struct{}
}

func (SuiteConfig) ShouldSkip added in v0.12.0

func (cfg SuiteConfig) ShouldSkip(suite string) bool

type SuiteOpt added in v0.12.0

type SuiteOpt func(*SuiteConfig)

func SkipSuites added in v0.12.0

func SkipSuites(suites ...string) SuiteOpt

type SuiteTest added in v0.11.0

type SuiteTest struct {
	File     string
	Result   bass.Value
	Bindings bass.Bindings
	Timeout  time.Duration
	ErrCause string
}

func (SuiteTest) Run added in v0.11.0

func (test SuiteTest) Run(ctx context.Context, t *testing.T, env *bass.Scope) (val bass.Value, err error)

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