mirror of https://github.com/docker/compose.git
Merge pull request #3039 from dbonev/3020-build-arguments-object-syntax
Allowing null for build args
This commit is contained in:
commit
7033042656
|
@ -58,20 +58,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"context": {"type": "string"},
|
"context": {"type": "string"},
|
||||||
"dockerfile": {"type": "string"},
|
"dockerfile": {"type": "string"},
|
||||||
"args": {
|
"args": {"$ref": "#/definitions/list_or_dict"}
|
||||||
"oneOf": [
|
|
||||||
{"$ref": "#/definitions/list_of_strings"},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"patternProperties": {
|
|
||||||
"^.+$": {
|
|
||||||
"type": ["string", "number"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ class ConfigTest(unittest.TestCase):
|
||||||
config.load(config_details)
|
config.load(config_details)
|
||||||
assert (
|
assert (
|
||||||
"services.web.build.args contains an invalid type, it should be an "
|
"services.web.build.args contains an invalid type, it should be an "
|
||||||
"array, or an object" in exc.exconly()
|
"object, or an array" in exc.exconly()
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_config_integer_service_name_raise_validation_error(self):
|
def test_config_integer_service_name_raise_validation_error(self):
|
||||||
|
@ -689,6 +689,31 @@ class ConfigTest(unittest.TestCase):
|
||||||
assert service['build']['args']['opt1'] == '42'
|
assert service['build']['args']['opt1'] == '42'
|
||||||
assert service['build']['args']['opt2'] == 'foobar'
|
assert service['build']['args']['opt2'] == 'foobar'
|
||||||
|
|
||||||
|
def test_build_args_allow_empty_properties(self):
|
||||||
|
service = config.load(
|
||||||
|
build_config_details(
|
||||||
|
{
|
||||||
|
'version': '2',
|
||||||
|
'services': {
|
||||||
|
'web': {
|
||||||
|
'build': {
|
||||||
|
'context': '.',
|
||||||
|
'dockerfile': 'Dockerfile-alt',
|
||||||
|
'args': {
|
||||||
|
'foo': None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'tests/fixtures/extends',
|
||||||
|
'filename.yml'
|
||||||
|
)
|
||||||
|
).services[0]
|
||||||
|
assert 'args' in service['build']
|
||||||
|
assert 'foo' in service['build']['args']
|
||||||
|
assert service['build']['args']['foo'] == 'None'
|
||||||
|
|
||||||
def test_load_with_multiple_files_mismatched_networks_format(self):
|
def test_load_with_multiple_files_mismatched_networks_format(self):
|
||||||
base_file = config.ConfigFile(
|
base_file = config.ConfigFile(
|
||||||
'base.yaml',
|
'base.yaml',
|
||||||
|
|
Loading…
Reference in New Issue