package client
import "github.com/moby/buildkit/client"
Index ¶
- Constants
- Variables
- type BuildkitVersion
- type CDIDevice
- type CacheOptionsEntry
- type Client
- func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error)
- func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildFunc gateway.BuildFunc, statusChan chan *SolveStatus) (*SolveResponse, error)
- func (c *Client) Close() error
- func (c *Client) ContentClient() contentapi.ContentClient
- func (c *Client) ControlClient() controlapi.ControlClient
- func (c *Client) Dialer() session.Dialer
- func (c *Client) DiskUsage(ctx context.Context, opts ...DiskUsageOption) ([]*UsageInfo, error)
- func (c *Client) GatewayClientForBuild(buildid string) gatewayapi.LLBBridgeClient
- func (c *Client) Info(ctx context.Context) (*Info, error)
- func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([]*WorkerInfo, error)
- func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOption) error
- func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, statusChan chan *SolveStatus) (*SolveResponse, error)
- func (c *Client) Wait(ctx context.Context) error
- type ClientOpt
- func WithContextDialer(df func(context.Context, string) (net.Conn, error)) ClientOpt
- func WithCredentials(cert, key string) ClientOpt
- func WithGRPCDialOption(opt grpc.DialOption) ClientOpt
- func WithServerConfig(serverName, caCert string) ClientOpt
- func WithServerConfigSystem(serverName string) ClientOpt
- func WithSessionDialer(dialer func(context.Context, string, map[string][]string) (net.Conn, error)) ClientOpt
- func WithTracerDelegate(td TracerDelegate) ClientOpt
- func WithTracerProvider(t trace.TracerProvider) ClientOpt
- type DiskUsageInfo
- type DiskUsageOption
- type ExportEntry
- type Filter
- func WithFilter(f []string) Filter
- func (f Filter) SetDiskUsageOption(di *DiskUsageInfo)
- func (f Filter) SetListWorkersOption(lwi *ListWorkersInfo)
- func (f Filter) SetPruneOption(pi *PruneInfo)
- type Info
- type ListWorkersInfo
- type ListWorkersOption
- type PruneInfo
- type PruneOption
- type SolveOpt
- type SolveResponse
- type SolveStatus
- func NewSolveStatus(resp *controlapi.StatusResponse) *SolveStatus
- func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse)
- type TracerDelegate
- type UsageInfo
- type UsageRecordType
- type Vertex
- type VertexLog
- type VertexStatus
- type VertexWarning
- type WorkerInfo
Constants ¶
const ( ExporterImage = "image" ExporterLocal = "local" ExporterTar = "tar" ExporterOCI = "oci" ExporterDocker = "docker" )
Variables ¶
Types ¶
type BuildkitVersion ¶
type BuildkitVersion struct { Package string `json:"package"` Version string `json:"version"` Revision string `json:"revision"` }
type CDIDevice ¶
type CDIDevice struct { Name string `json:"name"` AutoAllow bool `json:"autoAllow"` Annotations map[string]string `json:"annotations"` OnDemand bool `json:"onDemand"` }
type CacheOptionsEntry ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
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 (*Client) ContentClient ¶
func (c *Client) ContentClient() contentapi.ContentClient
func (*Client) ControlClient ¶
func (c *Client) ControlClient() controlapi.ControlClient
func (*Client) Dialer ¶
func (*Client) DiskUsage ¶
func (*Client) GatewayClientForBuild ¶
func (c *Client) GatewayClientForBuild(buildid string) gatewayapi.LLBBridgeClient
func (*Client) Info ¶
func (*Client) ListWorkers ¶
func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([]*WorkerInfo, error)
ListWorkers lists all active workers
func (*Client) Prune ¶
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.
func (*Client) Wait ¶
type ClientOpt ¶
type ClientOpt interface {
// contains filtered or unexported methods
}
func WithContextDialer ¶
func WithCredentials ¶
WithCredentials configures the TLS parameters of the client. Arguments: * cert: specifies the filepath of the client certificate * key: specifies the filepath of the client key
func WithGRPCDialOption ¶
func WithGRPCDialOption(opt grpc.DialOption) ClientOpt
func WithServerConfig ¶
WithServerConfig configures the TLS parameters to connect to the server. Arguments: * serverName: specifies the server name to verify the hostname * caCert: specifies the filepath of the CA certificate
func WithServerConfigSystem ¶
WithServerConfigSystem configures the TLS parameters to connect to the server, using the system's certificate pool.
func WithSessionDialer ¶
func WithSessionDialer(dialer func(context.Context, string, map[string][]string) (net.Conn, error)) ClientOpt
func WithTracerDelegate ¶
func WithTracerDelegate(td TracerDelegate) ClientOpt
func WithTracerProvider ¶
func WithTracerProvider(t trace.TracerProvider) ClientOpt
type DiskUsageInfo ¶
type DiskUsageInfo struct { Filter []string }
type DiskUsageOption ¶
type DiskUsageOption interface { SetDiskUsageOption(*DiskUsageInfo) }
type ExportEntry ¶
type ExportEntry struct { Type string Attrs map[string]string Output filesync.FileOutputFunc // for ExporterOCI and ExporterDocker OutputDir string // for ExporterLocal }
type Filter ¶
type Filter []string
func WithFilter ¶
func (Filter) SetDiskUsageOption ¶
func (f Filter) SetDiskUsageOption(di *DiskUsageInfo)
func (Filter) SetListWorkersOption ¶
func (f Filter) SetListWorkersOption(lwi *ListWorkersInfo)
func (Filter) SetPruneOption ¶
type Info ¶
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 { All bool `json:"all"` Filter []string `json:"filter"` KeepDuration time.Duration `json:"keepDuration"` ReservedSpace int64 `json:"reservedSpace"` MaxUsedSpace int64 `json:"maxUsedSpace"` MinFreeSpace int64 `json:"minFreeSpace"` }
type PruneOption ¶
type PruneOption interface { SetPruneOption(*PruneInfo) }
func WithKeepOpt ¶
type SolveOpt ¶
type SolveOpt struct { Exports []ExportEntry EnableSessionExporter bool LocalDirs map[string]string // Deprecated: use LocalMounts LocalMounts map[string]fsutil.FS OCIStores map[string]content.Store string Frontend string FrontendAttrs map[string]string FrontendInputs map[string]llb.State CacheExports []CacheOptionsEntry CacheImports []CacheOptionsEntry Session []session.Attachable AllowedEntitlements []string *session.Session // TODO: refactor to better session syncing SessionPreInitialized bool // TODO: refactor to better session syncing Internal bool SourcePolicy *spb.Policy Ref string }
type SolveResponse ¶
type SolveResponse struct { // ExporterResponse is also used for CacheExporter ExporterResponse map[string]string }
type SolveStatus ¶
type SolveStatus struct { Vertexes []*Vertex `json:"vertexes,omitempty"` Statuses []*VertexStatus `json:"statuses,omitempty"` Logs []*VertexLog `json:"logs,omitempty"` Warnings []*VertexWarning `json:"warnings,omitempty"` }
func NewSolveStatus ¶
func NewSolveStatus(resp *controlapi.StatusResponse) *SolveStatus
func (*SolveStatus) Marshal ¶
func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse)
type TracerDelegate ¶
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"` 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 `json:"digest,omitempty"` Inputs []digest.Digest `json:"inputs,omitempty"` Name string `json:"name,omitempty"` Started *time.Time `json:"started,omitempty"` Completed *time.Time `json:"completed,omitempty"` Cached bool `json:"cached,omitempty"` Error string `json:"error,omitempty"` ProgressGroup *pb.ProgressGroup `json:"progressGroup,omitempty"` }
type VertexLog ¶
type VertexLog struct { Vertex digest.Digest `json:"vertex,omitempty"` Stream int `json:"stream,omitempty"` Data []byte `json:"data"` Timestamp time.Time `json:"timestamp"` }
type VertexStatus ¶
type VertexStatus struct { ID string `json:"id"` Vertex digest.Digest `json:"vertex,omitempty"` Name string `json:"name,omitempty"` Total int64 `json:"total,omitempty"` Current int64 `json:"current"` Timestamp time.Time `json:"timestamp,omitempty"` Started *time.Time `json:"started,omitempty"` Completed *time.Time `json:"completed,omitempty"` }
type VertexWarning ¶
type VertexWarning struct { Vertex digest.Digest `json:"vertex,omitempty"` Level int `json:"level,omitempty"` Short []byte `json:"short,omitempty"` Detail [][]byte `json:"detail,omitempty"` URL string `json:"url,omitempty"` SourceInfo *pb.SourceInfo `json:"sourceInfo,omitempty"` Range []*pb.Range `json:"range,omitempty"` }
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"` CDIDevices []CDIDevice `json:"cdiDevices"` }
WorkerInfo contains information about a worker
Source Files ¶
build.go client.go diskusage.go exporters.go filter.go graph.go info.go prune.go solve.go status.go workers.go
Directories ¶
Path | Synopsis |
---|---|
client/buildid | |
client/connhelper | Package connhelper provides helpers for connecting to a remote daemon host with custom logic. |
client/connhelper/dockercontainer | Package dockercontainer provides connhelper for docker-container://<container> |
client/connhelper/kubepod | Package kubepod provides connhelper for kube-pod://<pod> |
client/connhelper/nerdctlcontainer | Package nerdctlcontainer provides connhelper for nerdctl-container://<container> |
client/connhelper/npipe | Package npipe provides connhelper for npipe://<address> |
client/connhelper/podmancontainer | Package podmancontainer provides connhelper for podman-container://<container> |
client/connhelper/ssh | Package ssh provides connhelper for ssh://<SSH URL> |
client/llb | |
client/llb/imagemetaresolver | |
client/llb/llbbuild | |
client/llb/llbtest | |
client/llb/sourceresolver | |
client/ociindex |
- Version
- v0.21.0 (latest)
- Published
- Apr 11, 2025
- Platform
- linux/amd64
- Imports
- 57 packages
- Last checked
- 7 hours ago –
Tools for package owners.