mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00

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>
25 lines
426 B
Go
25 lines
426 B
Go
package buildflags
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/moby/buildkit/util/entitlements"
|
|
)
|
|
|
|
func ParseEntitlements(in []string) ([]string, error) {
|
|
out := make([]string, 0, len(in))
|
|
log.Printf("in: %#v", in)
|
|
for _, v := range in {
|
|
if v == "" {
|
|
continue
|
|
}
|
|
|
|
if _, _, err := entitlements.Parse(v); err != nil {
|
|
return nil, err
|
|
}
|
|
out = append(out, v)
|
|
}
|
|
log.Printf("Parsed entitlements: %v", out)
|
|
return out, nil
|
|
}
|