2018-08-11 15:04:13 -04:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/moby/buildkit/solver/pb"
|
2018-10-05 05:05:42 -04:00
|
|
|
"github.com/moby/buildkit/util/apicaps"
|
2018-08-11 15:04:13 -04:00
|
|
|
digest "github.com/opencontainers/go-digest"
|
|
|
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
2018-10-05 05:05:42 -04:00
|
|
|
fstypes "github.com/tonistiigi/fsutil/types"
|
2018-08-11 15:04:13 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type Client interface {
|
|
|
|
Solve(ctx context.Context, req SolveRequest) (*Result, error)
|
|
|
|
ResolveImageConfig(ctx context.Context, ref string, opt ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
|
|
|
BuildOpts() BuildOpts
|
|
|
|
}
|
|
|
|
|
|
|
|
type Reference interface {
|
|
|
|
ReadFile(ctx context.Context, req ReadRequest) ([]byte, error)
|
2018-10-05 05:05:42 -04:00
|
|
|
StatFile(ctx context.Context, req StatRequest) (*fstypes.Stat, error)
|
|
|
|
ReadDir(ctx context.Context, req ReadDirRequest) ([]*fstypes.Stat, error)
|
2018-08-11 15:04:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type ReadRequest struct {
|
|
|
|
Filename string
|
|
|
|
Range *FileRange
|
|
|
|
}
|
|
|
|
|
|
|
|
type FileRange struct {
|
|
|
|
Offset int
|
|
|
|
Length int
|
|
|
|
}
|
|
|
|
|
2018-10-05 05:05:42 -04:00
|
|
|
type ReadDirRequest struct {
|
|
|
|
Path string
|
|
|
|
IncludePattern string
|
|
|
|
}
|
|
|
|
|
|
|
|
type StatRequest struct {
|
|
|
|
Path string
|
|
|
|
}
|
|
|
|
|
2018-08-11 15:04:13 -04:00
|
|
|
// SolveRequest is same as frontend.SolveRequest but avoiding dependency
|
|
|
|
type SolveRequest struct {
|
2019-04-03 02:23:23 -04:00
|
|
|
Definition *pb.Definition
|
|
|
|
Frontend string
|
|
|
|
FrontendOpt map[string]string
|
|
|
|
CacheImports []CacheOptionsEntry
|
|
|
|
}
|
|
|
|
|
|
|
|
type CacheOptionsEntry struct {
|
|
|
|
Type string
|
|
|
|
Attrs map[string]string
|
2018-08-11 15:04:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type WorkerInfo struct {
|
|
|
|
ID string
|
|
|
|
Labels map[string]string
|
|
|
|
Platforms []specs.Platform
|
|
|
|
}
|
|
|
|
|
|
|
|
type BuildOpts struct {
|
|
|
|
Opts map[string]string
|
|
|
|
SessionID string
|
|
|
|
Workers []WorkerInfo
|
|
|
|
Product string
|
2018-10-05 05:05:42 -04:00
|
|
|
LLBCaps apicaps.CapSet
|
|
|
|
Caps apicaps.CapSet
|
2018-08-11 15:04:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type ResolveImageConfigOpt struct {
|
|
|
|
Platform *specs.Platform
|
|
|
|
ResolveMode string
|
|
|
|
LogName string
|
|
|
|
}
|