mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
48
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
48
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
@ -43,6 +43,7 @@ type mount struct {
|
||||
selector string
|
||||
cacheID string
|
||||
tmpfs bool
|
||||
tmpfsOpt TmpfsInfo
|
||||
cacheSharing CacheMountSharingMode
|
||||
noOutput bool
|
||||
}
|
||||
@ -205,14 +206,6 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
meta.ExtraHosts = hosts
|
||||
}
|
||||
|
||||
shmSize, err := getShmSize(e.base)(ctx, c)
|
||||
if err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
if shmSize != nil {
|
||||
meta.ShmSize = *shmSize
|
||||
}
|
||||
|
||||
ulimits, err := getUlimit(e.base)(ctx, c)
|
||||
if err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
@ -275,6 +268,9 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
addCap(&e.constraints, pb.CapExecMountCacheSharing)
|
||||
} else if m.tmpfs {
|
||||
addCap(&e.constraints, pb.CapExecMountTmpfs)
|
||||
if m.tmpfsOpt.Size > 0 {
|
||||
addCap(&e.constraints, pb.CapExecMountTmpfsSize)
|
||||
}
|
||||
} else if m.source != nil {
|
||||
addCap(&e.constraints, pb.CapExecMountBind)
|
||||
}
|
||||
@ -359,6 +355,9 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
}
|
||||
if m.tmpfs {
|
||||
pm.MountType = pb.MountType_TMPFS
|
||||
pm.TmpfsOpt = &pb.TmpfsOpt{
|
||||
Size_: m.tmpfsOpt.Size,
|
||||
}
|
||||
}
|
||||
peo.Mounts = append(peo.Mounts, pm)
|
||||
}
|
||||
@ -479,12 +478,37 @@ func AsPersistentCacheDir(id string, sharing CacheMountSharingMode) MountOption
|
||||
}
|
||||
}
|
||||
|
||||
func Tmpfs() MountOption {
|
||||
func Tmpfs(opts ...TmpfsOption) MountOption {
|
||||
return func(m *mount) {
|
||||
t := &TmpfsInfo{}
|
||||
for _, opt := range opts {
|
||||
opt.SetTmpfsOption(t)
|
||||
}
|
||||
m.tmpfs = true
|
||||
m.tmpfsOpt = *t
|
||||
}
|
||||
}
|
||||
|
||||
type TmpfsOption interface {
|
||||
SetTmpfsOption(*TmpfsInfo)
|
||||
}
|
||||
|
||||
type tmpfsOptionFunc func(*TmpfsInfo)
|
||||
|
||||
func (fn tmpfsOptionFunc) SetTmpfsOption(ti *TmpfsInfo) {
|
||||
fn(ti)
|
||||
}
|
||||
|
||||
func TmpfsSize(b int64) TmpfsOption {
|
||||
return tmpfsOptionFunc(func(ti *TmpfsInfo) {
|
||||
ti.Size = b
|
||||
})
|
||||
}
|
||||
|
||||
type TmpfsInfo struct {
|
||||
Size int64
|
||||
}
|
||||
|
||||
type RunOption interface {
|
||||
SetRunOption(es *ExecInfo)
|
||||
}
|
||||
@ -524,12 +548,6 @@ func AddExtraHost(host string, ip net.IP) RunOption {
|
||||
})
|
||||
}
|
||||
|
||||
func WithShmSize(kb int64) RunOption {
|
||||
return runOptionFunc(func(ei *ExecInfo) {
|
||||
ei.State = ei.State.WithShmSize(kb)
|
||||
})
|
||||
}
|
||||
|
||||
func AddUlimit(name UlimitName, soft int64, hard int64) RunOption {
|
||||
return runOptionFunc(func(ei *ExecInfo) {
|
||||
ei.State = ei.State.AddUlimit(name, soft, hard)
|
||||
|
21
vendor/github.com/moby/buildkit/client/llb/meta.go
generated
vendored
21
vendor/github.com/moby/buildkit/client/llb/meta.go
generated
vendored
@ -20,7 +20,6 @@ var (
|
||||
keyEnv = contextKeyT("llb.exec.env")
|
||||
keyExtraHost = contextKeyT("llb.exec.extrahost")
|
||||
keyHostname = contextKeyT("llb.exec.hostname")
|
||||
keyShmSize = contextKeyT("llb.exec.shmsize")
|
||||
keyUlimit = contextKeyT("llb.exec.ulimit")
|
||||
keyUser = contextKeyT("llb.exec.user")
|
||||
|
||||
@ -235,26 +234,6 @@ type HostIP struct {
|
||||
IP net.IP
|
||||
}
|
||||
|
||||
func shmSize(kb int64) StateOption {
|
||||
return func(s State) State {
|
||||
return s.WithValue(keyShmSize, kb)
|
||||
}
|
||||
}
|
||||
|
||||
func getShmSize(s State) func(context.Context, *Constraints) (*int64, error) {
|
||||
return func(ctx context.Context, c *Constraints) (*int64, error) {
|
||||
v, err := s.getValue(keyShmSize)(ctx, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if v != nil {
|
||||
kb := v.(int64)
|
||||
return &kb, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
func ulimit(name UlimitName, soft int64, hard int64) StateOption {
|
||||
return func(s State) State {
|
||||
return s.withValue(keyUlimit, func(ctx context.Context, c *Constraints) (interface{}, error) {
|
||||
|
4
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
4
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
@ -397,10 +397,6 @@ func (s State) AddExtraHost(host string, ip net.IP) State {
|
||||
return extraHost(host, ip)(s)
|
||||
}
|
||||
|
||||
func (s State) WithShmSize(kb int64) State {
|
||||
return shmSize(kb)(s)
|
||||
}
|
||||
|
||||
func (s State) AddUlimit(name UlimitName, soft int64, hard int64) State {
|
||||
return ulimit(name, soft, hard)(s)
|
||||
}
|
||||
|
Reference in New Issue
Block a user