mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
build: add allowed entitlements
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
21
build/entitlements.go
Normal file
21
build/entitlements.go
Normal file
@ -0,0 +1,21 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"github.com/moby/buildkit/util/entitlements"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func ParseEntitlements(in []string) ([]entitlements.Entitlement, error) {
|
||||
out := make([]entitlements.Entitlement, 0, len(in))
|
||||
for _, v := range in {
|
||||
switch v {
|
||||
case "security.insecure":
|
||||
out = append(out, entitlements.EntitlementSecurityInsecure)
|
||||
case "network.host":
|
||||
out = append(out, entitlements.EntitlementNetworkHost)
|
||||
default:
|
||||
return nil, errors.Errorf("invalid entitlement: %v", v)
|
||||
}
|
||||
}
|
||||
return out, nil
|
||||
}
|
Reference in New Issue
Block a user