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)
|
||||
|
Reference in New Issue
Block a user