Skip to content

Commit f388192

Browse files
committed
build entitlements
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent facef9f commit f388192

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

loader/loader_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,3 +3204,26 @@ services:
32043204
assert.Equal(t, ports[0].AppProtocol, "http")
32053205
assert.Equal(t, ports[1].AppProtocol, "https")
32063206
}
3207+
3208+
func TestBuildEntitlements(t *testing.T) {
3209+
yaml := `
3210+
name: test-build-entitlements
3211+
services:
3212+
test:
3213+
build:
3214+
context: .
3215+
entitlements:
3216+
- network.host
3217+
- security.insecure
3218+
`
3219+
p, err := LoadWithContext(context.Background(), types.ConfigDetails{
3220+
ConfigFiles: []types.ConfigFile{
3221+
{
3222+
Content: []byte(yaml),
3223+
},
3224+
},
3225+
})
3226+
assert.NilError(t, err)
3227+
build := p.Services["test"].Build
3228+
assert.DeepEqual(t, build.Entitlements, []string{"network.host", "security.insecure"})
3229+
}

schema/compose-spec.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"context": {"type": "string"},
105105
"dockerfile": {"type": "string"},
106106
"dockerfile_inline": {"type": "string"},
107+
"entitlements": {"type": "array", "items": {"type": "string"}},
107108
"args": {"$ref": "#/definitions/list_or_dict"},
108109
"ssh": {"$ref": "#/definitions/list_or_dict"},
109110
"labels": {"$ref": "#/definitions/list_or_dict"},

types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ type BuildConfig struct {
266266
Context string `yaml:"context,omitempty" json:"context,omitempty"`
267267
Dockerfile string `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
268268
DockerfileInline string `yaml:"dockerfile_inline,omitempty" json:"dockerfile_inline,omitempty"`
269+
Entitlements []string `yaml:"entitlements,omitempty" json:"entitlements,omitempty"`
269270
Args MappingWithEquals `yaml:"args,omitempty" json:"args,omitempty"`
270271
SSH SSHConfig `yaml:"ssh,omitempty" json:"ssh,omitempty"`
271272
Labels Labels `yaml:"labels,omitempty" json:"labels,omitempty"`

0 commit comments

Comments
 (0)