diff --git a/loader/loader_test.go b/loader/loader_test.go index 2032b165..89796b6b 100644 --- a/loader/loader_test.go +++ b/loader/loader_test.go @@ -3204,3 +3204,26 @@ services: assert.Equal(t, ports[0].AppProtocol, "http") assert.Equal(t, ports[1].AppProtocol, "https") } + +func TestBuildEntitlements(t *testing.T) { + yaml := ` +name: test-build-entitlements +services: + test: + build: + context: . + entitlements: + - network.host + - security.insecure +` + p, err := LoadWithContext(context.Background(), types.ConfigDetails{ + ConfigFiles: []types.ConfigFile{ + { + Content: []byte(yaml), + }, + }, + }) + assert.NilError(t, err) + build := p.Services["test"].Build + assert.DeepEqual(t, build.Entitlements, []string{"network.host", "security.insecure"}) +} diff --git a/schema/compose-spec.json b/schema/compose-spec.json index 3a4ee727..cbe51db7 100644 --- a/schema/compose-spec.json +++ b/schema/compose-spec.json @@ -104,6 +104,7 @@ "context": {"type": "string"}, "dockerfile": {"type": "string"}, "dockerfile_inline": {"type": "string"}, + "entitlements": {"type": "array", "items": {"type": "string"}}, "args": {"$ref": "#/definitions/list_or_dict"}, "ssh": {"$ref": "#/definitions/list_or_dict"}, "labels": {"$ref": "#/definitions/list_or_dict"}, diff --git a/types/types.go b/types/types.go index 2ee7f4c4..466454c4 100644 --- a/types/types.go +++ b/types/types.go @@ -266,6 +266,7 @@ type BuildConfig struct { Context string `yaml:"context,omitempty" json:"context,omitempty"` Dockerfile string `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"` DockerfileInline string `yaml:"dockerfile_inline,omitempty" json:"dockerfile_inline,omitempty"` + Entitlements []string `yaml:"entitlements,omitempty" json:"entitlements,omitempty"` Args MappingWithEquals `yaml:"args,omitempty" json:"args,omitempty"` SSH SSHConfig `yaml:"ssh,omitempty" json:"ssh,omitempty"` Labels Labels `yaml:"labels,omitempty" json:"labels,omitempty"`