client

package
v0.11.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 55 Imported by: 793

Documentation

Index

Constants

View Source
const (
	ExporterImage  = "image"
	ExporterLocal  = "local"
	ExporterTar    = "tar"
	ExporterOCI    = "oci"
	ExporterDocker = "docker"
)

Variables

View Source
var PruneAll = pruneOptionFunc(func(pi *PruneInfo) {
	pi.All = true
})

Functions

This section is empty.

Types

type BuildkitVersion added in v0.11.0

type BuildkitVersion struct {
	Package  string `json:"package"`
	Version  string `json:"version"`
	Revision string `json:"revision"`
}

type CacheOptionsEntry added in v0.4.0

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

type Client

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

func New

func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error)

New returns a new buildkit client. Address can be empty for the system-default address.

func (*Client) Build

func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildFunc gateway.BuildFunc, statusChan chan *SolveStatus) (*SolveResponse, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) ContentClient added in v0.11.0

func (c *Client) ContentClient() contentapi.ContentClient

func (*Client) ControlClient added in v0.11.0

func (c *Client) ControlClient() controlapi.ControlClient

func (*Client) Dialer added in v0.8.0

func (c *Client) Dialer() session.Dialer

func (*Client) DiskUsage

func (c *Client) DiskUsage(ctx context.Context, opts ...DiskUsageOption) ([]*UsageInfo, error)

func (*Client) Info added in v0.11.0

func (c *Client) Info(ctx context.Context) (*Info, error)

func (*Client) ListWorkers

func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([]*WorkerInfo, error)

ListWorkers lists all active workers

func (*Client) Prune

func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOption) error

func (*Client) Solve

func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, statusChan chan *SolveStatus) (*SolveResponse, error)

Solve calls Solve on the controller. def must be nil if (and only if) opt.Frontend is set.

type ClientOpt

type ClientOpt interface{}

func WithContextDialer added in v0.8.0

func WithContextDialer(df func(context.Context, string) (net.Conn, error)) ClientOpt

func WithCredentials

func WithCredentials(serverName, ca, cert, key string) ClientOpt

WithCredentials configures the TLS parameters of the client. Arguments: * serverName: specifies the name of the target server * ca: specifies the filepath of the CA certificate to use for verification * cert: specifies the filepath of the client certificate * key: specifies the filepath of the client key

func WithFailFast

func WithFailFast() ClientOpt

func WithSessionDialer added in v0.10.0

func WithSessionDialer(dialer func(context.Context, string, map[string][]string) (net.Conn, error)) ClientOpt

func WithTracerDelegate added in v0.9.0

func WithTracerDelegate(td TracerDelegate) ClientOpt

func WithTracerProvider added in v0.9.0

func WithTracerProvider(t trace.TracerProvider) ClientOpt

type DiskUsageInfo

type DiskUsageInfo struct {
	Filter []string
}

type DiskUsageOption

type DiskUsageOption interface {
	SetDiskUsageOption(*DiskUsageInfo)
}

type ExportEntry added in v0.4.0

type ExportEntry struct {
	Type      string
	Attrs     map[string]string
	Output    func(map[string]string) (io.WriteCloser, error) // for ExporterOCI and ExporterDocker
	OutputDir string                                          // for ExporterLocal
}

type Filter

type Filter []string

func WithFilter

func WithFilter(f []string) Filter

func (Filter) SetDiskUsageOption

func (f Filter) SetDiskUsageOption(di *DiskUsageInfo)

func (Filter) SetListWorkersOption

func (f Filter) SetListWorkersOption(lwi *ListWorkersInfo)

func (Filter) SetPruneOption

func (f Filter) SetPruneOption(pi *PruneInfo)

type Info added in v0.11.0

type Info struct {
	BuildkitVersion BuildkitVersion `json:"buildkitVersion"`
}

type ListWorkersInfo

type ListWorkersInfo struct {
	Filter []string
}

ListWorkersInfo is a payload for worker list query

type ListWorkersOption

type ListWorkersOption interface {
	SetListWorkersOption(*ListWorkersInfo)
}

ListWorkersOption is an option for a worker list query

type PruneInfo

type PruneInfo struct {
	Filter       []string      `json:"filter"`
	All          bool          `json:"all"`
	KeepDuration time.Duration `json:"keepDuration"`
	KeepBytes    int64         `json:"keepBytes"`
}

type PruneOption

type PruneOption interface {
	SetPruneOption(*PruneInfo)
}

func WithKeepOpt

func WithKeepOpt(duration time.Duration, bytes int64) PruneOption

type SolveOpt

type SolveOpt struct {
	Exports               []ExportEntry
	LocalDirs             map[string]string
	OCIStores             map[string]content.Store
	SharedKey             string
	Frontend              string
	FrontendAttrs         map[string]string
	FrontendInputs        map[string]llb.State
	CacheExports          []CacheOptionsEntry
	CacheImports          []CacheOptionsEntry
	Session               []session.Attachable
	AllowedEntitlements   []entitlements.Entitlement
	SharedSession         *session.Session // TODO: refactor to better session syncing
	SessionPreInitialized bool             // TODO: refactor to better session syncing
	Internal              bool
	SourcePolicy          *spb.Policy
}

type SolveResponse

type SolveResponse struct {
	// ExporterResponse is also used for CacheExporter
	ExporterResponse map[string]string
}

type SolveStatus

type SolveStatus struct {
	Vertexes []*Vertex
	Statuses []*VertexStatus
	Logs     []*VertexLog
	Warnings []*VertexWarning
}

func NewSolveStatus added in v0.11.0

func NewSolveStatus(resp *controlapi.StatusResponse) *SolveStatus

func (*SolveStatus) Marshal added in v0.11.0

func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse)

type TracerDelegate added in v0.9.0

type TracerDelegate interface {
	SetSpanExporter(context.Context, sdktrace.SpanExporter) error
}

type UsageInfo

type UsageInfo struct {
	ID      string `json:"id"`
	Mutable bool   `json:"mutable"`
	InUse   bool   `json:"inUse"`
	Size    int64  `json:"size"`

	CreatedAt   time.Time       `json:"createdAt"`
	LastUsedAt  *time.Time      `json:"lastUsedAt"`
	UsageCount  int             `json:"usageCount"`
	Parents     []string        `json:"parents"`
	Description string          `json:"description"`
	RecordType  UsageRecordType `json:"recordType"`
	Shared      bool            `json:"shared"`
}

type UsageRecordType

type UsageRecordType string
const (
	UsageRecordTypeInternal    UsageRecordType = "internal"
	UsageRecordTypeFrontend    UsageRecordType = "frontend"
	UsageRecordTypeLocalSource UsageRecordType = "source.local"
	UsageRecordTypeGitCheckout UsageRecordType = "source.git.checkout"
	UsageRecordTypeCacheMount  UsageRecordType = "exec.cachemount"
	UsageRecordTypeRegular     UsageRecordType = "regular"
)

type Vertex

type Vertex struct {
	Digest        digest.Digest
	Inputs        []digest.Digest
	Name          string
	Started       *time.Time
	Completed     *time.Time
	Cached        bool
	Error         string
	ProgressGroup *pb.ProgressGroup
}

type VertexLog

type VertexLog struct {
	Vertex    digest.Digest
	Stream    int
	Data      []byte
	Timestamp time.Time
}

type VertexStatus

type VertexStatus struct {
	ID        string
	Vertex    digest.Digest
	Name      string
	Total     int64
	Current   int64
	Timestamp time.Time
	Started   *time.Time
	Completed *time.Time
}

type VertexWarning added in v0.10.0

type VertexWarning struct {
	Vertex     digest.Digest
	Level      int
	Short      []byte
	Detail     [][]byte
	URL        string
	SourceInfo *pb.SourceInfo
	Range      []*pb.Range
}

type WorkerInfo

type WorkerInfo struct {
	ID              string              `json:"id"`
	Labels          map[string]string   `json:"labels"`
	Platforms       []ocispecs.Platform `json:"platforms"`
	GCPolicy        []PruneInfo         `json:"gcPolicy"`
	BuildkitVersion BuildkitVersion     `json:"buildkitVersion"`
}

WorkerInfo contains information about a worker

Directories

Path Synopsis
Package connhelper provides helpers for connecting to a remote daemon host with custom logic.
Package connhelper provides helpers for connecting to a remote daemon host with custom logic.
dockercontainer
Package dockercontainer provides connhelper for docker-container://<container>
Package dockercontainer provides connhelper for docker-container://<container>
kubepod
Package kubepod provides connhelper for kube-pod://<pod>
Package kubepod provides connhelper for kube-pod://<pod>
podmancontainer
Package podmancontainer provides connhelper for podman-container://<container>
Package podmancontainer provides connhelper for podman-container://<container>
ssh
Package ssh provides connhelper for ssh://<SSH URL>
Package ssh provides connhelper for ssh://<SSH URL>
llb

Jump to

Keyboard shortcuts

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