Skip to content

Commit

Permalink
build entitlements
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof committed Apr 7, 2024
1 parent facef9f commit f388192
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions loader/loader_test.go
Expand Up @@ -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"})
}
1 change: 1 addition & 0 deletions schema/compose-spec.json
Expand Up @@ -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"},
Expand Down
1 change: 1 addition & 0 deletions types/types.go
Expand Up @@ -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"`
Expand Down

0 comments on commit f388192

Please sign in to comment.