mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 18:13:42 +08:00 
			
		
		
		
	Planned to be imported by nerdctl in future. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
		
			
				
	
	
		
			22 lines
		
	
	
		
			535 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			535 B
		
	
	
	
		
			Go
		
	
	
	
	
	
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
 | 
						|
}
 |