Merge pull request #542 from tonistiigi/resolvemode
llb: add resolvemode to image sourcedocker-18.09
commit
aa81807f1c
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/containerd/containerd/remotes/docker"
|
||||
"github.com/docker/docker/pkg/locker"
|
||||
"github.com/moby/buildkit/client/llb"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/util/contentutil"
|
||||
"github.com/moby/buildkit/util/imageutil"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
|
@ -19,7 +20,7 @@ import (
|
|||
var defaultImageMetaResolver llb.ImageMetaResolver
|
||||
var defaultImageMetaResolverOnce sync.Once
|
||||
|
||||
var WithDefault = llb.ImageOptionFunc(func(ii *llb.ImageInfo) {
|
||||
var WithDefault = imageOptionFunc(func(ii *llb.ImageInfo) {
|
||||
llb.WithMetaResolver(Default()).SetImageOption(ii)
|
||||
})
|
||||
|
||||
|
@ -71,10 +72,11 @@ type resolveResult struct {
|
|||
dgst digest.Digest
|
||||
}
|
||||
|
||||
func (imr *imageMetaResolver) ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error) {
|
||||
func (imr *imageMetaResolver) ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
|
||||
imr.locker.Lock(ref)
|
||||
defer imr.locker.Unlock(ref)
|
||||
|
||||
platform := opt.Platform
|
||||
if platform == nil {
|
||||
platform = imr.platform
|
||||
}
|
||||
|
@ -100,3 +102,9 @@ func (imr *imageMetaResolver) key(ref string, platform *specs.Platform) string {
|
|||
}
|
||||
return ref
|
||||
}
|
||||
|
||||
type imageOptionFunc func(*llb.ImageInfo)
|
||||
|
||||
func (fn imageOptionFunc) SetImageOption(ii *llb.ImageInfo) {
|
||||
fn(ii)
|
||||
}
|
||||
|
|
|
@ -3,16 +3,16 @@ package llb
|
|||
import (
|
||||
"context"
|
||||
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
func WithMetaResolver(mr ImageMetaResolver) ImageOption {
|
||||
return ImageOptionFunc(func(ii *ImageInfo) {
|
||||
return imageOptionFunc(func(ii *ImageInfo) {
|
||||
ii.metaResolver = mr
|
||||
})
|
||||
}
|
||||
|
||||
type ImageMetaResolver interface {
|
||||
ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
"github.com/moby/buildkit/util/apicaps"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
|
@ -101,12 +102,23 @@ func Image(ref string, opts ...ImageOption) State {
|
|||
|
||||
addCap(&info.Constraints, pb.CapSourceImage)
|
||||
|
||||
src := NewSource("docker-image://"+ref, nil, info.Constraints) // controversial
|
||||
attrs := map[string]string{}
|
||||
if info.resolveMode != 0 {
|
||||
attrs[pb.AttrImageResolveMode] = info.resolveMode.String()
|
||||
if info.resolveMode == ResolveModeForcePull {
|
||||
addCap(&info.Constraints, pb.CapSourceImageResolveMode) // only require cap for security enforced mode
|
||||
}
|
||||
}
|
||||
|
||||
src := NewSource("docker-image://"+ref, attrs, info.Constraints) // controversial
|
||||
if err != nil {
|
||||
src.err = err
|
||||
}
|
||||
if info.metaResolver != nil {
|
||||
_, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, info.Constraints.Platform)
|
||||
_, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, gw.ResolveImageConfigOpt{
|
||||
Platform: info.Constraints.Platform,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
})
|
||||
if err != nil {
|
||||
src.err = err
|
||||
} else {
|
||||
|
@ -143,15 +155,41 @@ type ImageOption interface {
|
|||
SetImageOption(*ImageInfo)
|
||||
}
|
||||
|
||||
type ImageOptionFunc func(*ImageInfo)
|
||||
type imageOptionFunc func(*ImageInfo)
|
||||
|
||||
func (fn ImageOptionFunc) SetImageOption(ii *ImageInfo) {
|
||||
func (fn imageOptionFunc) SetImageOption(ii *ImageInfo) {
|
||||
fn(ii)
|
||||
}
|
||||
|
||||
type ResolveMode int
|
||||
|
||||
const (
|
||||
ResolveModeDefault ResolveMode = iota
|
||||
ResolveModeForcePull
|
||||
ResolveModePreferLocal
|
||||
)
|
||||
|
||||
func (r ResolveMode) SetImageOption(ii *ImageInfo) {
|
||||
ii.resolveMode = r
|
||||
}
|
||||
|
||||
func (r ResolveMode) String() string {
|
||||
switch r {
|
||||
case ResolveModeDefault:
|
||||
return pb.AttrImageResolveModeDefault
|
||||
case ResolveModeForcePull:
|
||||
return pb.AttrImageResolveModeForcePull
|
||||
case ResolveModePreferLocal:
|
||||
return pb.AttrImageResolveModePreferLocal
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
type ImageInfo struct {
|
||||
constraintsWrapper
|
||||
metaResolver ImageMetaResolver
|
||||
resolveMode ResolveMode
|
||||
}
|
||||
|
||||
func Git(remote, ref string, opts ...GitOption) State {
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||
"github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb"
|
||||
"github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -34,6 +35,7 @@ const (
|
|||
keyNoCache = "no-cache"
|
||||
keyTargetPlatform = "platform"
|
||||
keyMultiPlatform = "multi-platform"
|
||||
keyImageResolveMode = "image-resolve-mode"
|
||||
)
|
||||
|
||||
var httpPrefix = regexp.MustCompile("^https?://")
|
||||
|
@ -57,6 +59,11 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
|||
}
|
||||
}
|
||||
|
||||
resolveMode, err := parseResolveMode(opts[keyImageResolveMode])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filename := opts[keyFilename]
|
||||
if filename == "" {
|
||||
filename = defaultDockerfileName
|
||||
|
@ -224,16 +231,17 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
|||
func(i int, tp *specs.Platform) {
|
||||
eg.Go(func() error {
|
||||
st, img, err := dockerfile2llb.Dockerfile2LLB(ctx, dtDockerfile, dockerfile2llb.ConvertOpt{
|
||||
Target: opts[keyTarget],
|
||||
MetaResolver: c,
|
||||
BuildArgs: filter(opts, buildArgPrefix),
|
||||
Labels: filter(opts, labelPrefix),
|
||||
SessionID: c.BuildOpts().SessionID,
|
||||
BuildContext: buildContext,
|
||||
Excludes: excludes,
|
||||
IgnoreCache: ignoreCache,
|
||||
TargetPlatform: tp,
|
||||
BuildPlatforms: buildPlatforms,
|
||||
Target: opts[keyTarget],
|
||||
MetaResolver: c,
|
||||
BuildArgs: filter(opts, buildArgPrefix),
|
||||
Labels: filter(opts, labelPrefix),
|
||||
SessionID: c.BuildOpts().SessionID,
|
||||
BuildContext: buildContext,
|
||||
Excludes: excludes,
|
||||
IgnoreCache: ignoreCache,
|
||||
TargetPlatform: tp,
|
||||
BuildPlatforms: buildPlatforms,
|
||||
ImageResolveMode: resolveMode,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -384,3 +392,16 @@ func parsePlatforms(v string) ([]*specs.Platform, error) {
|
|||
}
|
||||
return pp, nil
|
||||
}
|
||||
|
||||
func parseResolveMode(v string) (llb.ResolveMode, error) {
|
||||
switch v {
|
||||
case pb.AttrImageResolveModeDefault, "":
|
||||
return llb.ResolveModeDefault, nil
|
||||
case pb.AttrImageResolveModeForcePull:
|
||||
return llb.ResolveModeForcePull, nil
|
||||
case pb.AttrImageResolveModePreferLocal:
|
||||
return llb.ResolveModePreferLocal, nil
|
||||
default:
|
||||
return 0, errors.Errorf("invalid image-resolve-mode: %s", v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"github.com/moby/buildkit/frontend/dockerfile/instructions"
|
||||
"github.com/moby/buildkit/frontend/dockerfile/parser"
|
||||
"github.com/moby/buildkit/frontend/dockerfile/shell"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -47,6 +48,7 @@ type ConvertOpt struct {
|
|||
IgnoreCache []string
|
||||
// CacheIDNamespace scopes the IDs for different cache mounts
|
||||
CacheIDNamespace string
|
||||
ImageResolveMode llb.ResolveMode
|
||||
TargetPlatform *specs.Platform
|
||||
BuildPlatforms []specs.Platform
|
||||
}
|
||||
|
@ -186,7 +188,10 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
|
|||
d.stage.BaseName = reference.TagNameOnly(ref).String()
|
||||
var isScratch bool
|
||||
if metaResolver != nil && reachable {
|
||||
dgst, dt, err := metaResolver.ResolveImageConfig(ctx, d.stage.BaseName, platform)
|
||||
dgst, dt, err := metaResolver.ResolveImageConfig(ctx, d.stage.BaseName, gw.ResolveImageConfigOpt{
|
||||
Platform: platform,
|
||||
ResolveMode: opt.ImageResolveMode.String(),
|
||||
})
|
||||
if err == nil { // handle the error while builder is actually running
|
||||
var img Image
|
||||
if err := json.Unmarshal(dt, &img); err != nil {
|
||||
|
@ -215,7 +220,7 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
|
|||
if isScratch {
|
||||
d.state = llb.Scratch()
|
||||
} else {
|
||||
d.state = llb.Image(d.stage.BaseName, dfCmd(d.stage.SourceCode), llb.Platform(*platform))
|
||||
d.state = llb.Image(d.stage.BaseName, dfCmd(d.stage.SourceCode), llb.Platform(*platform), opt.ImageResolveMode)
|
||||
}
|
||||
d.platform = platform
|
||||
return nil
|
||||
|
|
|
@ -7,9 +7,8 @@ import (
|
|||
"github.com/moby/buildkit/cache"
|
||||
"github.com/moby/buildkit/client"
|
||||
"github.com/moby/buildkit/executor"
|
||||
gatewayclient "github.com/moby/buildkit/frontend/gateway/client"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
type Frontend interface {
|
||||
|
@ -18,11 +17,11 @@ type Frontend interface {
|
|||
|
||||
type FrontendLLBBridge interface {
|
||||
Solve(ctx context.Context, req SolveRequest) (*Result, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
||||
Exec(ctx context.Context, meta executor.Meta, rootfs cache.ImmutableRef, stdin io.ReadCloser, stdout, stderr io.WriteCloser) error
|
||||
}
|
||||
|
||||
type SolveRequest = gatewayclient.SolveRequest
|
||||
type SolveRequest = gw.SolveRequest
|
||||
|
||||
type WorkerInfos interface {
|
||||
WorkerInfos() []client.WorkerInfo
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
type Client interface {
|
||||
Solve(ctx context.Context, req SolveRequest) (*Result, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, opt ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
||||
BuildOpts() BuildOpts
|
||||
}
|
||||
|
||||
|
@ -50,3 +50,9 @@ type BuildOpts struct {
|
|||
Workers []WorkerInfo
|
||||
Product string
|
||||
}
|
||||
|
||||
type ResolveImageConfigOpt struct {
|
||||
Platform *specs.Platform
|
||||
ResolveMode string
|
||||
// Definition []byte
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"github.com/moby/buildkit/executor"
|
||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||
"github.com/moby/buildkit/frontend"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
pb "github.com/moby/buildkit/frontend/gateway/pb"
|
||||
"github.com/moby/buildkit/identity"
|
||||
"github.com/moby/buildkit/session"
|
||||
|
@ -109,7 +110,7 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten
|
|||
return nil, err
|
||||
}
|
||||
|
||||
dgst, config, err := llbBridge.ResolveImageConfig(ctx, reference.TagNameOnly(sourceRef).String(), nil) // TODO:
|
||||
dgst, config, err := llbBridge.ResolveImageConfig(ctx, reference.TagNameOnly(sourceRef).String(), gw.ResolveImageConfigOpt{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -322,7 +323,10 @@ func (lbf *llbBridgeForwarder) ResolveImageConfig(ctx context.Context, req *pb.R
|
|||
OSFeatures: p.OSFeatures,
|
||||
}
|
||||
}
|
||||
dgst, dt, err := lbf.llbBridge.ResolveImageConfig(ctx, req.Ref, platform)
|
||||
dgst, dt, err := lbf.llbBridge.ResolveImageConfig(ctx, req.Ref, gw.ResolveImageConfigOpt{
|
||||
Platform: platform,
|
||||
ResolveMode: req.ResolveMode,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
opspb "github.com/moby/buildkit/solver/pb"
|
||||
"github.com/moby/buildkit/util/apicaps"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/status"
|
||||
|
@ -290,9 +289,9 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (*clie
|
|||
return res, nil
|
||||
}
|
||||
|
||||
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error) {
|
||||
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt client.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
|
||||
var p *opspb.Platform
|
||||
if platform != nil {
|
||||
if platform := opt.Platform; platform != nil {
|
||||
p = &opspb.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
|
@ -301,7 +300,7 @@ func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, platfor
|
|||
OSFeatures: platform.OSFeatures,
|
||||
}
|
||||
}
|
||||
resp, err := c.client.ResolveImageConfig(ctx, &pb.ResolveImageConfigRequest{Ref: ref, Platform: p})
|
||||
resp, err := c.client.ResolveImageConfig(ctx, &pb.ResolveImageConfigRequest{Ref: ref, Platform: p, ResolveMode: opt.ResolveMode})
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
|
|
@ -9,12 +9,13 @@ var Caps apicaps.CapList
|
|||
// considered immutable. After a capability is marked stable it should not be disabled.
|
||||
|
||||
const (
|
||||
CapSolveBase apicaps.CapID = "solve.base"
|
||||
CapSolveInlineReturn apicaps.CapID = "solve.inlinereturn"
|
||||
CapResolveImage apicaps.CapID = "resolveimage"
|
||||
CapReadFile apicaps.CapID = "readfile"
|
||||
CapReturnResult apicaps.CapID = "return"
|
||||
CapReturnMap apicaps.CapID = "returnmap"
|
||||
CapSolveBase apicaps.CapID = "solve.base"
|
||||
CapSolveInlineReturn apicaps.CapID = "solve.inlinereturn"
|
||||
CapResolveImage apicaps.CapID = "resolveimage"
|
||||
CapResolveImageResolveMode apicaps.CapID = "resolveimage.resolvemode"
|
||||
CapReadFile apicaps.CapID = "readfile"
|
||||
CapReturnResult apicaps.CapID = "return"
|
||||
CapReturnMap apicaps.CapID = "returnmap"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -40,6 +41,13 @@ func init() {
|
|||
Status: apicaps.CapStatusExperimental,
|
||||
})
|
||||
|
||||
Caps.Init(apicaps.Cap{
|
||||
ID: CapResolveImageResolveMode,
|
||||
Name: "resolve remote image config with custom resolvemode",
|
||||
Enabled: true,
|
||||
Status: apicaps.CapStatusExperimental,
|
||||
})
|
||||
|
||||
Caps.Init(apicaps.Cap{
|
||||
ID: CapReadFile,
|
||||
Name: "read static file",
|
||||
|
|
|
@ -227,8 +227,9 @@ func (*ReturnResponse) ProtoMessage() {}
|
|||
func (*ReturnResponse) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{3} }
|
||||
|
||||
type ResolveImageConfigRequest struct {
|
||||
Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"`
|
||||
Platform *pb.Platform `protobuf:"bytes,2,opt,name=Platform" json:"Platform,omitempty"`
|
||||
Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"`
|
||||
Platform *pb.Platform `protobuf:"bytes,2,opt,name=Platform" json:"Platform,omitempty"`
|
||||
ResolveMode string `protobuf:"bytes,3,opt,name=ResolveMode,proto3" json:"ResolveMode,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ResolveImageConfigRequest) Reset() { *m = ResolveImageConfigRequest{} }
|
||||
|
@ -250,6 +251,13 @@ func (m *ResolveImageConfigRequest) GetPlatform() *pb.Platform {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *ResolveImageConfigRequest) GetResolveMode() string {
|
||||
if m != nil {
|
||||
return m.ResolveMode
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ResolveImageConfigResponse struct {
|
||||
Digest github_com_opencontainers_go_digest.Digest `protobuf:"bytes,1,opt,name=Digest,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"Digest"`
|
||||
Config []byte `protobuf:"bytes,2,opt,name=Config,proto3" json:"Config,omitempty"`
|
||||
|
@ -890,6 +898,12 @@ func (m *ResolveImageConfigRequest) MarshalTo(dAtA []byte) (int, error) {
|
|||
}
|
||||
i += n5
|
||||
}
|
||||
if len(m.ResolveMode) > 0 {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGateway(dAtA, i, uint64(len(m.ResolveMode)))
|
||||
i += copy(dAtA[i:], m.ResolveMode)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
|
@ -1304,6 +1318,10 @@ func (m *ResolveImageConfigRequest) Size() (n int) {
|
|||
l = m.Platform.Size()
|
||||
n += 1 + l + sovGateway(uint64(l))
|
||||
}
|
||||
l = len(m.ResolveMode)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGateway(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -2111,6 +2129,35 @@ func (m *ResolveImageConfigRequest) Unmarshal(dAtA []byte) error {
|
|||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ResolveMode", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGateway
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthGateway
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ResolveMode = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGateway(dAtA[iNdEx:])
|
||||
|
@ -3295,13 +3342,13 @@ var (
|
|||
func init() { proto.RegisterFile("gateway.proto", fileDescriptorGateway) }
|
||||
|
||||
var fileDescriptorGateway = []byte{
|
||||
// 969 bytes of a gzipped FileDescriptorProto
|
||||
// 982 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x4b, 0x6f, 0xdb, 0x46,
|
||||
0x10, 0x0e, 0x4d, 0x49, 0x91, 0x46, 0x52, 0xac, 0x2e, 0x8a, 0x42, 0xe1, 0xc1, 0x51, 0x89, 0x22,
|
||||
0x65, 0xf3, 0x20, 0x51, 0xa5, 0x45, 0xd2, 0x04, 0x48, 0x1b, 0xd9, 0x31, 0xe2, 0x56, 0x41, 0x84,
|
||||
0xcd, 0xc1, 0x40, 0xd0, 0x1e, 0x56, 0xd2, 0x92, 0x26, 0x4c, 0x71, 0xd9, 0xe5, 0xca, 0xae, 0xd0,
|
||||
0x65, 0xf3, 0x20, 0x51, 0xa5, 0x45, 0xd2, 0x04, 0x48, 0x1b, 0xd9, 0x31, 0xe2, 0x56, 0x46, 0x84,
|
||||
0xcd, 0x21, 0x40, 0xd0, 0x1e, 0x56, 0xd2, 0x92, 0x26, 0x4c, 0x71, 0xd9, 0xe5, 0xca, 0xae, 0xd0,
|
||||
0x4b, 0xdb, 0x53, 0x7e, 0x5a, 0x8e, 0x3d, 0xf7, 0x10, 0x14, 0xbe, 0xf5, 0x5f, 0x14, 0xfb, 0xa0,
|
||||
0x4c, 0xbf, 0x64, 0xfb, 0xa4, 0x9d, 0xe5, 0x7c, 0x33, 0xdf, 0xce, 0x7c, 0xb3, 0x2b, 0x68, 0x47,
|
||||
0x4c, 0xbf, 0x64, 0xfb, 0xa4, 0x9d, 0xe5, 0x7c, 0x33, 0xdf, 0xec, 0x7c, 0xb3, 0x2b, 0x68, 0x47,
|
||||
0x44, 0xd0, 0x43, 0xb2, 0xf0, 0x33, 0xce, 0x04, 0x43, 0xb7, 0x67, 0x6c, 0xbc, 0xf0, 0xc7, 0xf3,
|
||||
0x38, 0x99, 0xee, 0xc7, 0xc2, 0x3f, 0xf8, 0xda, 0x0f, 0x39, 0x4b, 0x05, 0x4d, 0xa7, 0xce, 0xc3,
|
||||
0x28, 0x16, 0x7b, 0xf3, 0xb1, 0x3f, 0x61, 0xb3, 0x20, 0x62, 0x11, 0x0b, 0x14, 0x62, 0x3c, 0x0f,
|
||||
|
@ -3312,49 +3359,50 @@ var fileDescriptorGateway = []byte{
|
|||
0x0b, 0x01, 0x73, 0x11, 0x27, 0x12, 0x35, 0x21, 0x59, 0x2e, 0x93, 0xc8, 0x5f, 0x0d, 0x72, 0xff,
|
||||
0xb3, 0xa0, 0x86, 0x69, 0x3e, 0x4f, 0x04, 0x42, 0x60, 0x73, 0x1a, 0x76, 0xad, 0x9e, 0xe5, 0x35,
|
||||
0x5e, 0xdd, 0xc0, 0xd2, 0x40, 0x8f, 0xa1, 0xc2, 0x69, 0x98, 0x77, 0xd7, 0x7a, 0x96, 0xd7, 0xec,
|
||||
0x7f, 0xee, 0x5f, 0x58, 0x3f, 0x1f, 0xd3, 0xf0, 0x35, 0xc9, 0x5e, 0xdd, 0xc0, 0x0a, 0x80, 0x7e,
|
||||
0x7f, 0xee, 0x5f, 0x78, 0x7e, 0x3e, 0xa6, 0xe1, 0x2e, 0xc9, 0x5e, 0xdd, 0xc0, 0x0a, 0x80, 0x7e,
|
||||
0x82, 0xfa, 0x8c, 0x0a, 0x32, 0x25, 0x82, 0x74, 0xa1, 0x67, 0x7b, 0xcd, 0x7e, 0xb0, 0x12, 0x2c,
|
||||
0x19, 0xf8, 0xaf, 0x0d, 0xe2, 0x65, 0x2a, 0xf8, 0x02, 0x2f, 0x03, 0x38, 0xcf, 0xa0, 0x7d, 0xe2,
|
||||
0x13, 0xea, 0x80, 0xbd, 0x4f, 0x17, 0x9a, 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,
|
||||
0x4c, 0x27, 0x8c, 0x4f, 0x71, 0x01, 0xea, 0xbf, 0xaf, 0x40, 0x63, 0x38, 0x1c, 0x0c, 0x78, 0x3c,
|
||||
0x8d, 0x28, 0xfa, 0xd3, 0x02, 0x74, 0xf6, 0x3e, 0x41, 0xdf, 0xac, 0x56, 0xc9, 0xf9, 0x17, 0x9b,
|
||||
0xf3, 0xed, 0x35, 0x51, 0xa6, 0xca, 0xef, 0xa0, 0xaa, 0x54, 0x8c, 0xbe, 0xbc, 0xe2, 0x9c, 0x3b,
|
||||
0xde, 0xe5, 0x8e, 0x26, 0xf6, 0x04, 0xea, 0x85, 0x12, 0xd0, 0xbd, 0x95, 0xf4, 0x4e, 0x08, 0xdd,
|
||||
0xb9, 0x7f, 0x25, 0x5f, 0x93, 0x64, 0x17, 0x2a, 0x52, 0x46, 0xe8, 0xee, 0x0a, 0x50, 0x49, 0x67,
|
||||
0xce, 0xaa, 0x73, 0x9e, 0xd0, 0xdf, 0x2f, 0xf2, 0x49, 0x55, 0x77, 0x8c, 0xb7, 0x92, 0x4f, 0xe9,
|
||||
0xc5, 0x73, 0xbe, 0xba, 0x82, 0xa7, 0x0e, 0x3f, 0x68, 0x7d, 0x38, 0xda, 0xb0, 0xfe, 0x3e, 0xda,
|
||||
0xb0, 0xfe, 0x3d, 0xda, 0xb0, 0xc6, 0x35, 0xf5, 0x9f, 0xe5, 0xd1, 0xff, 0x01, 0x00, 0x00, 0xff,
|
||||
0xff, 0xb8, 0xcb, 0x8c, 0xfa, 0xd6, 0x09, 0x00, 0x00,
|
||||
0x19, 0xf8, 0xbb, 0x06, 0xf1, 0x32, 0x15, 0x7c, 0x81, 0x97, 0x01, 0x9c, 0x67, 0xd0, 0x3e, 0xf1,
|
||||
0x09, 0x75, 0xc0, 0xde, 0xa7, 0x0b, 0x4d, 0x15, 0xcb, 0x25, 0xfa, 0x14, 0xaa, 0x07, 0x24, 0x99,
|
||||
0x53, 0xc5, 0xb4, 0x85, 0xb5, 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0x4f, 0x71, 0x01, 0xea, 0xbf, 0xaf, 0x40, 0x63, 0x38, 0x1c, 0x0c, 0x78, 0x3c, 0x8d, 0x28, 0xfa,
|
||||
0xd3, 0x02, 0x74, 0xf6, 0x3e, 0x41, 0xdf, 0xac, 0x56, 0xc9, 0xf9, 0x57, 0x9f, 0xf3, 0xed, 0x35,
|
||||
0x51, 0xe6, 0x94, 0xdf, 0x41, 0x55, 0xa9, 0x18, 0x7d, 0x79, 0xc5, 0x39, 0x77, 0xbc, 0xcb, 0x1d,
|
||||
0x4d, 0xec, 0x09, 0xd4, 0x0b, 0x25, 0xa0, 0x7b, 0x2b, 0xe9, 0x9d, 0x10, 0xba, 0x73, 0xff, 0x4a,
|
||||
0xbe, 0x26, 0xc9, 0x5b, 0xa8, 0x48, 0x19, 0xa1, 0xbb, 0x2b, 0x40, 0x25, 0x9d, 0x39, 0xab, 0xea,
|
||||
0x3c, 0xa1, 0xbf, 0x5f, 0xe4, 0xa3, 0xab, 0xee, 0x18, 0x6f, 0x25, 0x9f, 0xd2, 0x9b, 0xe8, 0x7c,
|
||||
0x75, 0x05, 0x4f, 0x1d, 0x7e, 0xd0, 0xfa, 0x70, 0xb4, 0x61, 0xfd, 0x7d, 0xb4, 0x61, 0xfd, 0x7b,
|
||||
0xb4, 0x61, 0x8d, 0x6b, 0xea, 0x5f, 0xcd, 0xa3, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x11,
|
||||
0x1c, 0x4b, 0xf8, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ message ReturnResponse {
|
|||
message ResolveImageConfigRequest {
|
||||
string Ref = 1;
|
||||
pb.Platform Platform = 2;
|
||||
string ResolveMode = 3;
|
||||
/* bytes Definition = 4;*/
|
||||
}
|
||||
|
||||
message ResolveImageConfigResponse {
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/moby/buildkit/cache/remotecache"
|
||||
"github.com/moby/buildkit/executor"
|
||||
"github.com/moby/buildkit/frontend"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/solver"
|
||||
"github.com/moby/buildkit/util/tracing"
|
||||
"github.com/moby/buildkit/worker"
|
||||
|
@ -127,12 +128,12 @@ func (s *llbBridge) Exec(ctx context.Context, meta executor.Meta, root cache.Imm
|
|||
return err
|
||||
}
|
||||
|
||||
func (s *llbBridge) ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error) {
|
||||
func (s *llbBridge) ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
|
||||
w, err := s.resolveWorker()
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return w.ResolveImageConfig(ctx, ref, platform)
|
||||
return w.ResolveImageConfig(ctx, ref, opt)
|
||||
}
|
||||
|
||||
type lazyCacheManager struct {
|
||||
|
|
|
@ -15,3 +15,8 @@ const AttrHTTPFilename = "http.filename"
|
|||
const AttrHTTPPerm = "http.perm"
|
||||
const AttrHTTPUID = "http.uid"
|
||||
const AttrHTTPGID = "http.gid"
|
||||
|
||||
const AttrImageResolveMode = "image.resolvemode"
|
||||
const AttrImageResolveModeDefault = "default"
|
||||
const AttrImageResolveModeForcePull = "pull"
|
||||
const AttrImageResolveModePreferLocal = "local"
|
||||
|
|
|
@ -10,6 +10,7 @@ var Caps apicaps.CapList
|
|||
|
||||
const (
|
||||
CapSourceImage apicaps.CapID = "source.image"
|
||||
CapSourceImageResolveMode apicaps.CapID = "source.image.resolvemode"
|
||||
CapSourceLocal apicaps.CapID = "source.local"
|
||||
CapSourceLocalUnique apicaps.CapID = "source.local.unique"
|
||||
CapSourceLocalSessionID apicaps.CapID = "source.local.sessionid"
|
||||
|
@ -54,6 +55,12 @@ func init() {
|
|||
Status: apicaps.CapStatusExperimental,
|
||||
})
|
||||
|
||||
Caps.Init(apicaps.Cap{
|
||||
ID: CapSourceImageResolveMode,
|
||||
Enabled: true,
|
||||
Status: apicaps.CapStatusExperimental,
|
||||
})
|
||||
|
||||
Caps.Init(apicaps.Cap{
|
||||
ID: CapSourceLocal,
|
||||
Enabled: true,
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/moby/buildkit/cache"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/session"
|
||||
"github.com/moby/buildkit/snapshot"
|
||||
"github.com/moby/buildkit/source"
|
||||
|
@ -53,17 +54,23 @@ func (is *imageSource) ID() string {
|
|||
return source.DockerImageScheme
|
||||
}
|
||||
|
||||
func (is *imageSource) ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error) {
|
||||
func (is *imageSource) ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
|
||||
type t struct {
|
||||
dgst digest.Digest
|
||||
dt []byte
|
||||
}
|
||||
key := ref
|
||||
if platform != nil {
|
||||
if platform := opt.Platform; platform != nil {
|
||||
key += platforms.Format(*platform)
|
||||
}
|
||||
|
||||
rm, err := source.ParseImageResolveMode(opt.ResolveMode)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
res, err := is.g.Do(ctx, key, func(ctx context.Context) (interface{}, error) {
|
||||
dgst, dt, err := imageutil.Config(ctx, ref, pull.NewResolver(ctx, is.SessionManager, is.ImageStore), is.ContentStore, platform)
|
||||
dgst, dt, err := imageutil.Config(ctx, ref, pull.NewResolver(ctx, is.SessionManager, is.ImageStore, rm), is.ContentStore, opt.Platform)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -92,7 +99,7 @@ func (is *imageSource) Resolve(ctx context.Context, id source.Identifier) (sourc
|
|||
ContentStore: is.ContentStore,
|
||||
Applier: is.Applier,
|
||||
Src: imageIdentifier.Reference,
|
||||
Resolver: pull.NewResolver(ctx, is.SessionManager, is.ImageStore),
|
||||
Resolver: pull.NewResolver(ctx, is.SessionManager, is.ImageStore, imageIdentifier.ResolveMode),
|
||||
Platform: &platform,
|
||||
}
|
||||
p := &puller{
|
||||
|
|
|
@ -17,6 +17,14 @@ var (
|
|||
errNotFound = errors.New("not found")
|
||||
)
|
||||
|
||||
type ResolveMode int
|
||||
|
||||
const (
|
||||
ResolveModeDefault ResolveMode = iota
|
||||
ResolveModeForcePull
|
||||
ResolveModePreferLocal
|
||||
)
|
||||
|
||||
const (
|
||||
DockerImageScheme = "docker-image"
|
||||
GitScheme = "git"
|
||||
|
@ -51,18 +59,32 @@ func FromString(s string) (Identifier, error) {
|
|||
return nil, errors.Wrapf(errNotFound, "unknown schema %s", parts[0])
|
||||
}
|
||||
}
|
||||
|
||||
func FromLLB(op *pb.Op_Source, platform *pb.Platform) (Identifier, error) {
|
||||
id, err := FromString(op.Source.Identifier)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if id, ok := id.(*ImageIdentifier); ok && platform != nil {
|
||||
id.Platform = &specs.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
Variant: platform.Variant,
|
||||
OSVersion: platform.OSVersion,
|
||||
OSFeatures: platform.OSFeatures,
|
||||
|
||||
if id, ok := id.(*ImageIdentifier); ok {
|
||||
if platform != nil {
|
||||
id.Platform = &specs.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
Variant: platform.Variant,
|
||||
OSVersion: platform.OSVersion,
|
||||
OSFeatures: platform.OSFeatures,
|
||||
}
|
||||
}
|
||||
for k, v := range op.Source.Attrs {
|
||||
switch k {
|
||||
case pb.AttrImageResolveMode:
|
||||
rm, err := ParseImageResolveMode(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
id.ResolveMode = rm
|
||||
}
|
||||
}
|
||||
}
|
||||
if id, ok := id.(*GitIdentifier); ok {
|
||||
|
@ -145,8 +167,9 @@ func FromLLB(op *pb.Op_Source, platform *pb.Platform) (Identifier, error) {
|
|||
}
|
||||
|
||||
type ImageIdentifier struct {
|
||||
Reference reference.Spec
|
||||
Platform *specs.Platform
|
||||
Reference reference.Spec
|
||||
Platform *specs.Platform
|
||||
ResolveMode ResolveMode
|
||||
}
|
||||
|
||||
func NewImageIdentifier(str string) (*ImageIdentifier, error) {
|
||||
|
@ -203,3 +226,16 @@ type HttpIdentifier struct {
|
|||
func (_ *HttpIdentifier) ID() string {
|
||||
return HttpsScheme
|
||||
}
|
||||
|
||||
func ParseImageResolveMode(v string) (ResolveMode, error) {
|
||||
switch v {
|
||||
case pb.AttrImageResolveModeDefault, "":
|
||||
return ResolveModeDefault, nil
|
||||
case pb.AttrImageResolveModeForcePull:
|
||||
return ResolveModeForcePull, nil
|
||||
case pb.AttrImageResolveModePreferLocal:
|
||||
return ResolveModePreferLocal, nil
|
||||
default:
|
||||
return 0, errors.Errorf("invalid resolvemode: %s", v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,21 +9,22 @@ import (
|
|||
"github.com/containerd/containerd/remotes/docker"
|
||||
"github.com/moby/buildkit/session"
|
||||
"github.com/moby/buildkit/session/auth"
|
||||
"github.com/moby/buildkit/source"
|
||||
"github.com/moby/buildkit/util/tracing"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
func NewResolver(ctx context.Context, sm *session.Manager, imageStore images.Store) remotes.Resolver {
|
||||
func NewResolver(ctx context.Context, sm *session.Manager, imageStore images.Store, mode source.ResolveMode) remotes.Resolver {
|
||||
r := docker.NewResolver(docker.ResolverOptions{
|
||||
Client: tracing.DefaultClient,
|
||||
Credentials: getCredentialsFromSession(ctx, sm),
|
||||
})
|
||||
|
||||
if imageStore == nil {
|
||||
if imageStore == nil || mode == source.ResolveModeForcePull {
|
||||
return r
|
||||
}
|
||||
|
||||
return localFallbackResolver{r, imageStore}
|
||||
return withLocalResolver{r, imageStore, mode}
|
||||
}
|
||||
|
||||
func getCredentialsFromSession(ctx context.Context, sm *session.Manager) func(string) (string, string, error) {
|
||||
|
@ -56,20 +57,29 @@ func getCredentialsFromSession(ctx context.Context, sm *session.Manager) func(st
|
|||
// request.
|
||||
// - Pusher wouldn't make sense to push locally, so just forward.
|
||||
|
||||
type localFallbackResolver struct {
|
||||
type withLocalResolver struct {
|
||||
remotes.Resolver
|
||||
is images.Store
|
||||
is images.Store
|
||||
mode source.ResolveMode
|
||||
}
|
||||
|
||||
func (r localFallbackResolver) Resolve(ctx context.Context, ref string) (string, ocispec.Descriptor, error) {
|
||||
func (r withLocalResolver) Resolve(ctx context.Context, ref string) (string, ocispec.Descriptor, error) {
|
||||
if r.mode == source.ResolveModePreferLocal {
|
||||
if img, err := r.is.Get(ctx, ref); err == nil {
|
||||
return ref, img.Target, nil
|
||||
}
|
||||
}
|
||||
|
||||
n, desc, err := r.Resolver.Resolve(ctx, ref)
|
||||
if err == nil {
|
||||
return n, desc, err
|
||||
}
|
||||
|
||||
img, err2 := r.is.Get(ctx, ref)
|
||||
if err2 != nil {
|
||||
return "", ocispec.Descriptor{}, err
|
||||
if r.mode == source.ResolveModeDefault {
|
||||
if img, err := r.is.Get(ctx, ref); err == nil {
|
||||
return ref, img.Target, nil
|
||||
}
|
||||
}
|
||||
return ref, img.Target, nil
|
||||
|
||||
return "", ocispec.Descriptor{}, err
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
localexporter "github.com/moby/buildkit/exporter/local"
|
||||
ociexporter "github.com/moby/buildkit/exporter/oci"
|
||||
"github.com/moby/buildkit/frontend"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/identity"
|
||||
"github.com/moby/buildkit/session"
|
||||
"github.com/moby/buildkit/snapshot"
|
||||
|
@ -223,17 +224,17 @@ func (w *Worker) ResolveOp(v solver.Vertex, s frontend.FrontendLLBBridge) (solve
|
|||
return nil, errors.Errorf("could not resolve %v", v)
|
||||
}
|
||||
|
||||
func (w *Worker) ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error) {
|
||||
func (w *Worker) ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
|
||||
// ImageSource is typically source/containerimage
|
||||
resolveImageConfig, ok := w.ImageSource.(resolveImageConfig)
|
||||
if !ok {
|
||||
return "", nil, errors.Errorf("worker %q does not implement ResolveImageConfig", w.ID())
|
||||
}
|
||||
return resolveImageConfig.ResolveImageConfig(ctx, ref, platform)
|
||||
return resolveImageConfig.ResolveImageConfig(ctx, ref, opt)
|
||||
}
|
||||
|
||||
type resolveImageConfig interface {
|
||||
ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
||||
}
|
||||
|
||||
func (w *Worker) Exec(ctx context.Context, meta executor.Meta, rootFS cache.ImmutableRef, stdin io.ReadCloser, stdout, stderr io.WriteCloser) error {
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/moby/buildkit/executor"
|
||||
"github.com/moby/buildkit/exporter"
|
||||
"github.com/moby/buildkit/frontend"
|
||||
gw "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/solver"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
@ -22,7 +23,7 @@ type Worker interface {
|
|||
LoadRef(id string) (cache.ImmutableRef, error)
|
||||
// ResolveOp resolves Vertex.Sys() to Op implementation.
|
||||
ResolveOp(v solver.Vertex, s frontend.FrontendLLBBridge) (solver.Op, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error)
|
||||
ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
||||
// Exec is similar to executor.Exec but without []mount.Mount
|
||||
Exec(ctx context.Context, meta executor.Meta, rootFS cache.ImmutableRef, stdin io.ReadCloser, stdout, stderr io.WriteCloser) error
|
||||
DiskUsage(ctx context.Context, opt client.DiskUsageInfo) ([]*client.UsageInfo, error)
|
||||
|
|
Loading…
Reference in New Issue