client

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 313

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttestationFromPB added in v0.11.0

func AttestationFromPB[T any](a *pb.Attestation) (*result.Attestation[T], error)

func AttestationToPB added in v0.11.0

func AttestationToPB[T any](a *result.Attestation[T]) (*pb.Attestation, error)

Types

type Attestation added in v0.11.0

type Attestation = result.Attestation[Reference]

type BuildFunc

type BuildFunc func(context.Context, Client) (*Result, error)

type BuildOpts

type BuildOpts struct {
	Opts      map[string]string
	SessionID string
	Workers   []WorkerInfo
	Product   string
	LLBCaps   apicaps.CapSet
	Caps      apicaps.CapSet
}

type CacheOptionsEntry added in v0.4.0

type CacheOptionsEntry struct {
	Type  string
	Attrs map[string]string
}

type Client

type Client interface {
	sourceresolver.MetaResolver
	Solve(ctx context.Context, req SolveRequest) (*Result, error)
	ResolveImageConfig(ctx context.Context, ref string, opt sourceresolver.Opt) (string, digest.Digest, []byte, error)
	BuildOpts() BuildOpts
	Inputs(ctx context.Context) (map[string]llb.State, error)
	NewContainer(ctx context.Context, req NewContainerRequest) (Container, error)
	Warn(ctx context.Context, dgst digest.Digest, msg string, opts WarnOpts) error
}

type Container added in v0.8.0

type Container interface {
	Start(context.Context, StartRequest) (ContainerProcess, error)
	Release(context.Context) error
}

Container is used to start new processes inside a container and release the container resources when done.

type ContainerProcess added in v0.8.0

type ContainerProcess interface {
	Wait() error
	Resize(ctx context.Context, size WinSize) error
	Signal(ctx context.Context, sig syscall.Signal) error
}

ContainerProcess represents a process within a container.

type FileRange

type FileRange struct {
	Offset int
	Length int
}

type Mount added in v0.8.0

type Mount struct {
	Selector  string
	Dest      string
	ResultID  string
	Ref       Reference
	Readonly  bool
	MountType pb.MountType
	CacheOpt  *pb.CacheOpt
	SecretOpt *pb.SecretOpt
	SSHOpt    *pb.SSHOpt
}

Mount allows clients to specify a filesystem mount. A Reference to a previously solved Result is required.

type NewContainerRequest added in v0.8.0

type NewContainerRequest struct {
	Mounts      []Mount
	Hostname    string
	NetMode     pb.NetMode
	ExtraHosts  []*pb.HostIP
	Platform    *pb.Platform
	Constraints *pb.WorkerConstraints
}

NewContainerRequest encapsulates the requirements for a client to define a new container, without defining the initial process.

type ReadDirRequest

type ReadDirRequest struct {
	Path           string
	IncludePattern string
}

type ReadRequest

type ReadRequest struct {
	Filename string
	Range    *FileRange
}

type Reference

type Reference interface {
	ToState() (llb.State, error)
	Evaluate(ctx context.Context) error
	ReadFile(ctx context.Context, req ReadRequest) ([]byte, error)
	StatFile(ctx context.Context, req StatRequest) (*fstypes.Stat, error)
	ReadDir(ctx context.Context, req ReadDirRequest) ([]*fstypes.Stat, error)
}

type Result

type Result = result.Result[Reference]

func NewResult

func NewResult() *Result

type SolveRequest

type SolveRequest struct {
	Evaluate       bool
	Definition     *pb.Definition
	Frontend       string
	FrontendOpt    map[string]string
	FrontendInputs map[string]*pb.Definition
	CacheImports   []CacheOptionsEntry
	SourcePolicies []*spb.Policy
}

SolveRequest is same as frontend.SolveRequest but avoiding dependency

type StartRequest added in v0.8.0

type StartRequest struct {
	Args           []string
	Env            []string
	SecretEnv      []*pb.SecretEnv
	User           string
	Cwd            string
	Tty            bool
	Stdin          io.ReadCloser
	Stdout, Stderr io.WriteCloser
	SecurityMode   pb.SecurityMode

	RemoveMountStubsRecursive bool
}

StartRequest encapsulates the arguments to define a process within a container.

type StatRequest

type StatRequest struct {
	Path string
}

type WarnOpts added in v0.10.0

type WarnOpts struct {
	Level      int
	SourceInfo *pb.SourceInfo
	Range      []*pb.Range
	Detail     [][]byte
	URL        string
}

type WinSize added in v0.8.0

type WinSize struct {
	Rows uint32
	Cols uint32
}

WinSize is same as executor.WinSize, copied here to prevent circular package dependencies.

type WorkerInfo

type WorkerInfo struct {
	ID        string
	Labels    map[string]string
	Platforms []ocispecs.Platform
}

Jump to

Keyboard shortcuts

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