vendor: update buildkit to v0.20.0-rc1

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2025-02-11 12:43:07 -08:00
parent 350d3f0f4b
commit 03569c2188
22 changed files with 1733 additions and 628 deletions

View File

@ -60,6 +60,7 @@ type ExecOp struct {
isValidated bool
secrets []SecretInfo
ssh []SSHInfo
cdiDevices []CDIDeviceInfo
}
func (e *ExecOp) AddMount(target string, source Output, opt ...MountOption) Output {
@ -266,6 +267,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
Network: network,
Security: security,
}
if network != NetModeSandbox {
addCap(&e.constraints, pb.CapExecMetaNetwork)
}
@ -321,6 +323,18 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
addCap(&e.constraints, pb.CapExecMountSSH)
}
if len(e.cdiDevices) > 0 {
addCap(&e.constraints, pb.CapExecMetaCDI)
cd := make([]*pb.CDIDevice, len(e.cdiDevices))
for i, d := range e.cdiDevices {
cd[i] = &pb.CDIDevice{
Name: d.Name,
Optional: d.Optional,
}
}
peo.CdiDevices = cd
}
if e.constraints.Platform == nil {
p, err := getPlatform(e.base)(ctx, c)
if err != nil {
@ -624,6 +638,41 @@ func AddUlimit(name UlimitName, soft int64, hard int64) RunOption {
})
}
func AddCDIDevice(opts ...CDIDeviceOption) RunOption {
return runOptionFunc(func(ei *ExecInfo) {
c := &CDIDeviceInfo{}
for _, opt := range opts {
opt.SetCDIDeviceOption(c)
}
ei.CDIDevices = append(ei.CDIDevices, *c)
})
}
type CDIDeviceOption interface {
SetCDIDeviceOption(*CDIDeviceInfo)
}
type cdiDeviceOptionFunc func(*CDIDeviceInfo)
func (fn cdiDeviceOptionFunc) SetCDIDeviceOption(ci *CDIDeviceInfo) {
fn(ci)
}
func CDIDeviceName(name string) CDIDeviceOption {
return cdiDeviceOptionFunc(func(ci *CDIDeviceInfo) {
ci.Name = name
})
}
var CDIDeviceOptional = cdiDeviceOptionFunc(func(ci *CDIDeviceInfo) {
ci.Optional = true
})
type CDIDeviceInfo struct {
Name string
Optional bool
}
func ValidExitCodes(codes ...int) RunOption {
return runOptionFunc(func(ei *ExecInfo) {
ei.State = validExitCodes(codes...)(ei.State)
@ -815,6 +864,7 @@ type ExecInfo struct {
ProxyEnv *ProxyEnv
Secrets []SecretInfo
SSH []SSHInfo
CDIDevices []CDIDeviceInfo
}
type MountInfo struct {