Merge pull request #2994 from tonistiigi/device-entitlements

support for device entitlement in build and bake
This commit is contained in:
CrazyMax
2025-02-18 22:28:23 +01:00
committed by GitHub
16 changed files with 203 additions and 56 deletions

View File

@ -1,19 +1,24 @@
package buildflags
import "github.com/moby/buildkit/util/entitlements"
import (
"log"
func ParseEntitlements(in []string) ([]entitlements.Entitlement, error) {
out := make([]entitlements.Entitlement, 0, len(in))
"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
}
e, err := entitlements.Parse(v)
if err != nil {
if _, _, err := entitlements.Parse(v); err != nil {
return nil, err
}
out = append(out, e)
out = append(out, v)
}
log.Printf("Parsed entitlements: %v", out)
return out, nil
}