mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
support for device entitlement in build and bake
Allow access to CDI Devices in Buildkit v0.20.0+ for devices that are not automatically allowed to be used by everyone in BuildKit configuration. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
14
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
14
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"maps"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -24,7 +25,6 @@ import (
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
spb "github.com/moby/buildkit/sourcepolicy/pb"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/entitlements"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tonistiigi/fsutil"
|
||||
@ -45,7 +45,7 @@ type SolveOpt struct {
|
||||
CacheExports []CacheOptionsEntry
|
||||
CacheImports []CacheOptionsEntry
|
||||
Session []session.Attachable
|
||||
AllowedEntitlements []entitlements.Entitlement
|
||||
AllowedEntitlements []string
|
||||
SharedSession *session.Session // TODO: refactor to better session syncing
|
||||
SessionPreInitialized bool // TODO: refactor to better session syncing
|
||||
Internal bool
|
||||
@ -277,7 +277,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
FrontendAttrs: frontendAttrs,
|
||||
FrontendInputs: frontendInputs,
|
||||
Cache: &cacheOpt.options,
|
||||
Entitlements: entitlementsToPB(opt.AllowedEntitlements),
|
||||
Entitlements: slices.Clone(opt.AllowedEntitlements),
|
||||
Internal: opt.Internal,
|
||||
SourcePolicy: opt.SourcePolicy,
|
||||
})
|
||||
@ -553,11 +553,3 @@ func prepareMounts(opt *SolveOpt) (map[string]fsutil.FS, error) {
|
||||
}
|
||||
return mounts, nil
|
||||
}
|
||||
|
||||
func entitlementsToPB(entitlements []entitlements.Entitlement) []string {
|
||||
clone := make([]string, len(entitlements))
|
||||
for i, e := range entitlements {
|
||||
clone[i] = string(e)
|
||||
}
|
||||
return clone
|
||||
}
|
||||
|
Reference in New Issue
Block a user