mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-14 07:27:07 +08:00
build: split buildflags package
Planned to be imported by nerdctl in future. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
21
util/buildflags/entitlements.go
Normal file
21
util/buildflags/entitlements.go
Normal file
@ -0,0 +1,21 @@
|
||||
package buildflags
|
||||
|
||||
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