Skip to content

Commit 01cc80e

Browse files
committed
add secrets property to build section
Signed-off-by: Guillaume Lours <[email protected]>
1 parent b2e6407 commit 01cc80e

File tree

4 files changed

+61
-2
lines changed

4 files changed

+61
-2
lines changed

loader/full-example.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ services:
1515
- foo
1616
- bar
1717
labels: [FOO=BAR]
18+
secrets:
19+
- secret1
20+
- source: secret2
21+
target: my_secret
22+
uid: '103'
23+
gid: '103'
24+
mode: 0440
1825

1926

2027
cap_add:

loader/full-struct_test.go

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
5858
Network: "foo",
5959
CacheFrom: []string{"foo", "bar"},
6060
Labels: map[string]string{"FOO": "BAR"},
61+
Secrets: []types.ServiceSecretConfig{
62+
{
63+
Source: "secret1",
64+
},
65+
{
66+
Source: "secret2",
67+
Target: "my_secret",
68+
UID: "103",
69+
GID: "103",
70+
Mode: uint32Ptr(0440),
71+
},
72+
},
6173
},
6274
CapAdd: []string{"ALL"},
6375
CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"},
@@ -579,6 +591,13 @@ services:
579591
- bar
580592
network: foo
581593
target: foo
594+
secrets:
595+
- source: secret1
596+
- source: secret2
597+
target: my_secret
598+
uid: "103"
599+
gid: "103"
600+
mode: 288
582601
cap_add:
583602
- ALL
584603
cap_drop:
@@ -1096,7 +1115,19 @@ func fullExampleJSON(workingDir, homeDir string) string {
10961115
"bar"
10971116
],
10981117
"network": "foo",
1099-
"target": "foo"
1118+
"target": "foo",
1119+
"secrets": [
1120+
{
1121+
"source": "secret1"
1122+
},
1123+
{
1124+
"source": "secret2",
1125+
"target": "my_secret",
1126+
"uid": "103",
1127+
"gid": "103",
1128+
"mode": 288
1129+
}
1130+
]
11001131
},
11011132
"cap_add": [
11021133
"ALL"

schema/compose-spec.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,27 @@
9999
"target": {"type": "string"},
100100
"shm_size": {"type": ["integer", "string"]},
101101
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
102-
"isolation": {"type": "string"}
102+
"isolation": {"type": "string"},
103+
"secrets": {
104+
"type": "array",
105+
"items": {
106+
"oneOf": [
107+
{"type": "string"},
108+
{
109+
"type": "object",
110+
"properties": {
111+
"source": {"type": "string"},
112+
"target": {"type": "string"},
113+
"uid": {"type": "string"},
114+
"gid": {"type": "string"},
115+
"mode": {"type": "number"}
116+
},
117+
"additionalProperties": false,
118+
"patternProperties": {"^x-": {}}
119+
}
120+
]
121+
}
122+
}
103123
},
104124
"additionalProperties": false,
105125
"patternProperties": {"^x-": {}}

types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ type BuildConfig struct {
302302
Isolation string `yaml:",omitempty" json:"isolation,omitempty"`
303303
Network string `yaml:",omitempty" json:"network,omitempty"`
304304
Target string `yaml:",omitempty" json:"target,omitempty"`
305+
Secrets []ServiceSecretConfig `yaml:",omitempty" json:"secrets,omitempty"`
305306

306307
Extensions map[string]interface{} `yaml:",inline" json:"-"`
307308
}

0 commit comments

Comments
 (0)