Skip to content

Commit

Permalink
compose: add build.extra_hosts to v3.9 schema
Browse files Browse the repository at this point in the history
This is not currently used by the CLI, but can be used by
docker compose to bring parity on this feature with the
compose v2.4 schema.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed May 10, 2020
1 parent f7185d2 commit 0c5f97e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 39 deletions.
3 changes: 3 additions & 0 deletions cli/compose/loader/full-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ services:
cache_from:
- foo
- bar
extra_hosts:
- "ipv4.example.com:127.0.0.1"
- "ipv6.example.com:::1"
labels: [FOO=BAR]


Expand Down
13 changes: 12 additions & 1 deletion cli/compose/loader/full-struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
Target: "foo",
Network: "foo",
CacheFrom: []string{"foo", "bar"},
Labels: map[string]string{"FOO": "BAR"},
ExtraHosts: types.HostsList{
"ipv4.example.com:127.0.0.1",
"ipv6.example.com:::1",
},
Labels: map[string]string{"FOO": "BAR"},
},
CapAdd: []string{"ALL"},
CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"},
Expand Down Expand Up @@ -526,6 +530,9 @@ services:
cache_from:
- foo
- bar
extra_hosts:
- ipv4.example.com:127.0.0.1
- ipv6.example.com:::1
network: foo
target: foo
cap_add:
Expand Down Expand Up @@ -998,6 +1005,10 @@ func fullExampleJSON(workingDir string) string {
"foo",
"bar"
],
"extra_hosts": [
"ipv4.example.com:127.0.0.1",
"ipv6.example.com:::1"
],
"network": "foo",
"target": "foo"
},
Expand Down
74 changes: 37 additions & 37 deletions cli/compose/schema/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cli/compose/schema/data/config_schema_v3.9.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"cache_from": {"$ref": "#/definitions/list_of_strings"},
"network": {"type": "string"},
"target": {"type": "string"},
"shm_size": {"type": ["integer", "string"]}
"shm_size": {"type": ["integer", "string"]},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
}
Expand Down
1 change: 1 addition & 0 deletions cli/compose/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ type BuildConfig struct {
Args MappingWithEquals `yaml:",omitempty" json:"args,omitempty"`
Labels Labels `yaml:",omitempty" json:"labels,omitempty"`
CacheFrom StringList `mapstructure:"cache_from" yaml:"cache_from,omitempty" json:"cache_from,omitempty"`
ExtraHosts HostsList `mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty"`
Network string `yaml:",omitempty" json:"network,omitempty"`
Target string `yaml:",omitempty" json:"target,omitempty"`
}
Expand Down

0 comments on commit 0c5f97e

Please sign in to comment.