solver

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildkitClient

func BuildkitClient(ctx context.Context, addr string) (*client.Client, error)

BuildkitClient returns a basic buildkit client.

func NewRemoteDirectory

func NewRemoteDirectory(ctx context.Context, cln *client.Client, pw progress.Writer, def *llb.Definition, root string, dgst digest.Digest, solveOpts []SolveOption, sessionOpts []llbutil.SessionOption) (ast.Directory, error)

NewRemoteDirectory returns an ast.Directory representing a directory backed by a BuildKit gateway reference. Since gateway references only live while the build session is running, the build only exits when the ast.Directory is closed.

func Solve

func Solve(ctx context.Context, c *client.Client, s *session.Session, pw progress.Writer, def *llb.Definition, opts ...SolveOption) error

func TreeFromDef

func TreeFromDef(tree treeprint.Tree, def *llb.Definition, opts []SolveOption) error

func WithEvaluate

func WithEvaluate(info *SolveInfo) error

Types

type Console

type Console interface {
	io.ReadWriteCloser

	// Fd returns its file descriptor
	Fd() uintptr

	// Name returns its file name
	Name() string
}

Console is intended to match the `File` interface from package `github.com/containerd/console`.

type ContainerConfig

type ContainerConfig struct {
	Cmd    []string          `json:"Cmd"`
	Labels map[string]string `json:"Labels"`
}

ContainerConfig is the schema1-compatible configuration of the container that is committed into the image.

type ErrorHandler

type ErrorHandler func(context.Context, gateway.Client, error) error

type ImageSpec

type ImageSpec struct {
	specs.Image

	ContainerConfig ContainerConfig `json:"container_config,omitempty"`

	// Canonical is the fully qualified reference of the image with name and
	// digest.
	Canonical reference.Canonical `json:"-"`
}

ImageSpec is HLB's wrapper for the OCI specs image, allowing for backward compatible features with Docker.

type MultiWriter

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

MultiWriter is similar to progress.MultiWriter, but deduplicates writes by vertex.

func NewMultiWriter

func NewMultiWriter(pw progress.Writer) *MultiWriter

func (*MultiWriter) WithPrefix

func (mw *MultiWriter) WithPrefix(pfx string, force bool) progress.Writer

type Params

type Params struct {
	Def         *llb.Definition
	SolveOpts   []SolveOption
	SessionOpts []llbutil.SessionOption
}

type Progress

type Progress interface {
	MultiWriter() *MultiWriter

	Wait() error

	// Sync will ensure that all progress has been written.
	Sync() error
}

func NewProgress

func NewProgress(ctx context.Context, opts ...ProgressOption) (Progress, error)

NewProgress returns a Progress that presents all the progress on multiple solves to the terminal stdout.

type ProgressOption

type ProgressOption func(*progressInfo) error

func WithLogOutputPlain

func WithLogOutputPlain(w io.Writer) ProgressOption

func WithLogOutputTTY

func WithLogOutputTTY(con Console) ProgressOption

type Request

type Request interface {
	// Solve sends the request and its children to BuildKit. The request passes
	// down the progress.Writer for them to spawn their own progress writers
	// for each independent solve.
	Solve(ctx context.Context, cln *client.Client, mw *MultiWriter, opts ...SolveOption) error

	Tree(tree treeprint.Tree) error
}

Request is a node in the solve request tree produced by the compiler. The solve request tree has peer nodes that should be executed in parallel, and next nodes that should be executed sequentially. These can be intermingled to produce a complex build pipeline.

func NilRequest

func NilRequest() Request

func Parallel

func Parallel(candidates ...Request) Request

func Sequential

func Sequential(candidates ...Request) Request

func Single

func Single(params *Params) Request

Single returns a single solve request.

type SolveCallback

type SolveCallback func(ctx context.Context, resp *client.SolveResponse) error

type SolveInfo

type SolveInfo struct {
	Evaluate               bool
	OutputMoby             bool
	OutputDockerRef        string
	OutputPushImage        string
	OutputLocal            string
	OutputLocalTarball     bool
	OutputLocalOCITarball  bool
	OutputStargz           bool
	OutputForceCompression bool
	Callbacks              []SolveCallback `json:"-"`
	ImageSpec              *ImageSpec
	ErrorHandler           ErrorHandler
	Entitlements           []entitlements.Entitlement
}

type SolveOption

type SolveOption func(*SolveInfo) error

func WithCallback

func WithCallback(fn SolveCallback) SolveOption

func WithDownload

func WithDownload(dest string) SolveOption

func WithDownloadDockerTarball

func WithDownloadDockerTarball(ref string) SolveOption

func WithDownloadMoby

func WithDownloadMoby(ref string) SolveOption

func WithDownloadOCITarball

func WithDownloadOCITarball() SolveOption

func WithDownloadTarball

func WithDownloadTarball() SolveOption

func WithEntitlement

func WithEntitlement(e entitlements.Entitlement) SolveOption

func WithErrorHandler

func WithErrorHandler(errorHandler ErrorHandler) SolveOption

func WithImageSpec

func WithImageSpec(spec *ImageSpec) SolveOption

func WithPushImage

func WithPushImage(ref string) SolveOption

func WithPushMoby

func WithPushMoby(ref string) SolveOption

func WithStargz

func WithStargz(forceCompression bool) SolveOption

Jump to

Keyboard shortcuts

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