mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to v0.20.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
20
vendor/github.com/moby/buildkit/client/info.go
generated
vendored
20
vendor/github.com/moby/buildkit/client/info.go
generated
vendored
@ -18,6 +18,13 @@ type BuildkitVersion struct {
|
||||
Revision string `json:"revision"`
|
||||
}
|
||||
|
||||
type CDIDevice struct {
|
||||
Name string `json:"name"`
|
||||
AutoAllow bool `json:"autoAllow"`
|
||||
Annotations map[string]string `json:"annotations"`
|
||||
OnDemand bool `json:"onDemand"`
|
||||
}
|
||||
|
||||
func (c *Client) Info(ctx context.Context) (*Info, error) {
|
||||
res, err := c.ControlClient().Info(ctx, &controlapi.InfoRequest{})
|
||||
if err != nil {
|
||||
@ -38,3 +45,16 @@ func fromAPIBuildkitVersion(in *apitypes.BuildkitVersion) BuildkitVersion {
|
||||
Revision: in.Revision,
|
||||
}
|
||||
}
|
||||
|
||||
func fromAPICDIDevices(in []*apitypes.CDIDevice) []CDIDevice {
|
||||
var out []CDIDevice
|
||||
for _, d := range in {
|
||||
out = append(out, CDIDevice{
|
||||
Name: d.Name,
|
||||
AutoAllow: d.AutoAllow,
|
||||
Annotations: d.Annotations,
|
||||
OnDemand: d.OnDemand,
|
||||
})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
50
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
50
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
@ -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 {
|
||||
|
1
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
1
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
@ -295,6 +295,7 @@ func (s State) Run(ro ...RunOption) ExecState {
|
||||
}
|
||||
exec.secrets = ei.Secrets
|
||||
exec.ssh = ei.SSH
|
||||
exec.cdiDevices = ei.CDIDevices
|
||||
|
||||
return ExecState{
|
||||
State: s.WithOutput(exec.Output()),
|
||||
|
2
vendor/github.com/moby/buildkit/client/workers.go
generated
vendored
2
vendor/github.com/moby/buildkit/client/workers.go
generated
vendored
@ -18,6 +18,7 @@ type WorkerInfo struct {
|
||||
Platforms []ocispecs.Platform `json:"platforms"`
|
||||
GCPolicy []PruneInfo `json:"gcPolicy"`
|
||||
BuildkitVersion BuildkitVersion `json:"buildkitVersion"`
|
||||
CDIDevices []CDIDevice `json:"cdiDevices"`
|
||||
}
|
||||
|
||||
// ListWorkers lists all active workers
|
||||
@ -42,6 +43,7 @@ func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([]
|
||||
Platforms: pb.ToSpecPlatforms(w.Platforms),
|
||||
GCPolicy: fromAPIGCPolicy(w.GCPolicy),
|
||||
BuildkitVersion: fromAPIBuildkitVersion(w.BuildkitVersion),
|
||||
CDIDevices: fromAPICDIDevices(w.CDIDevices),
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user