mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: bump buildkit to master
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
62
vendor/github.com/moby/buildkit/client/llb/source.go
generated
vendored
62
vendor/github.com/moby/buildkit/client/llb/source.go
generated
vendored
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
_ "crypto/sha256" // for opencontainers/go-digest
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -132,8 +133,9 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
p = c.Platform
|
||||
}
|
||||
_, dt, err := info.metaResolver.ResolveImageConfig(ctx, ref, ResolveImageConfigOpt{
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
ResolverType: ResolverTypeRegistry,
|
||||
})
|
||||
if err != nil {
|
||||
return State{}, err
|
||||
@ -147,8 +149,9 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
p = c.Platform
|
||||
}
|
||||
dgst, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, ResolveImageConfigOpt{
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
ResolverType: ResolverTypeRegistry,
|
||||
})
|
||||
if err != nil {
|
||||
return State{}, err
|
||||
@ -452,6 +455,57 @@ func Differ(t DiffType, required bool) LocalOption {
|
||||
})
|
||||
}
|
||||
|
||||
func OCILayout(contentStoreID string, dig digest.Digest, opts ...OCILayoutOption) State {
|
||||
gi := &OCILayoutInfo{}
|
||||
|
||||
for _, o := range opts {
|
||||
o.SetOCILayoutOption(gi)
|
||||
}
|
||||
attrs := map[string]string{}
|
||||
if gi.sessionID != "" {
|
||||
attrs[pb.AttrOCILayoutSessionID] = gi.sessionID
|
||||
addCap(&gi.Constraints, pb.CapSourceOCILayoutSessionID)
|
||||
}
|
||||
|
||||
if ll := gi.layerLimit; ll != nil {
|
||||
attrs[pb.AttrOCILayoutLayerLimit] = strconv.FormatInt(int64(*ll), 10)
|
||||
addCap(&gi.Constraints, pb.CapSourceOCILayoutLayerLimit)
|
||||
}
|
||||
|
||||
addCap(&gi.Constraints, pb.CapSourceOCILayout)
|
||||
|
||||
source := NewSource(fmt.Sprintf("oci-layout://%s@%s", contentStoreID, dig), attrs, gi.Constraints)
|
||||
return NewState(source.Output())
|
||||
}
|
||||
|
||||
type OCILayoutOption interface {
|
||||
SetOCILayoutOption(*OCILayoutInfo)
|
||||
}
|
||||
|
||||
type ociLayoutOptionFunc func(*OCILayoutInfo)
|
||||
|
||||
func (fn ociLayoutOptionFunc) SetOCILayoutOption(li *OCILayoutInfo) {
|
||||
fn(li)
|
||||
}
|
||||
|
||||
func OCISessionID(id string) OCILayoutOption {
|
||||
return ociLayoutOptionFunc(func(oi *OCILayoutInfo) {
|
||||
oi.sessionID = id
|
||||
})
|
||||
}
|
||||
|
||||
func OCILayerLimit(limit int) OCILayoutOption {
|
||||
return ociLayoutOptionFunc(func(oi *OCILayoutInfo) {
|
||||
oi.layerLimit = &limit
|
||||
})
|
||||
}
|
||||
|
||||
type OCILayoutInfo struct {
|
||||
constraintsWrapper
|
||||
sessionID string
|
||||
layerLimit *int
|
||||
}
|
||||
|
||||
type DiffType string
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user