mirror of
https://github.com/containers/podman-compose.git
synced 2025-03-31 19:27:42 +02:00
Merge pull request #1166 from piotr-kubiak/megre-args
Allow merging of args in both list and dict syntax
This commit is contained in:
commit
4d899edeb3
1
newsfragments/1163.bugfix
Normal file
1
newsfragments/1163.bugfix
Normal file
@ -0,0 +1 @@
|
||||
- Fixed error when merging args in list and dict syntax
|
@ -1607,6 +1607,9 @@ def normalize_service(service, sub_dir=""):
|
||||
for k, v in build["additional_contexts"].items():
|
||||
new_additional_contexts.append(f"{k}={v}")
|
||||
build["additional_contexts"] = new_additional_contexts
|
||||
if "build" in service and "args" in service["build"]:
|
||||
if isinstance(build["args"], dict):
|
||||
build["args"] = norm_as_list(build["args"])
|
||||
for key in ("command", "entrypoint"):
|
||||
if key in service:
|
||||
if isinstance(service[key], str):
|
||||
|
@ -68,6 +68,16 @@ class TestCanMergeBuild(unittest.TestCase):
|
||||
{"build": {"dockerfile": "./dockerfile-1", "args": ["ENV2=2"]}},
|
||||
{"build": {"dockerfile": "./dockerfile-1", "args": ["ENV1=1", "ENV2=2"]}},
|
||||
),
|
||||
(
|
||||
{"build": {"dockerfile": "./dockerfile-1", "args": {"ENV1": "1"}}},
|
||||
{"build": {"dockerfile": "./dockerfile-2", "args": {"ENV2": "2"}}},
|
||||
{"build": {"dockerfile": "./dockerfile-2", "args": ["ENV1=1", "ENV2=2"]}},
|
||||
),
|
||||
(
|
||||
{"build": {"dockerfile": "./dockerfile-1", "args": ["ENV1=1"]}},
|
||||
{"build": {"dockerfile": "./dockerfile-2", "args": {"ENV2": "2"}}},
|
||||
{"build": {"dockerfile": "./dockerfile-2", "args": ["ENV1=1", "ENV2=2"]}},
|
||||
),
|
||||
])
|
||||
def test_parse_compose_file_when_multiple_composes(self, input, override, expected):
|
||||
compose_test_1 = {"services": {"test-service": input}}
|
||||
|
Loading…
Reference in New Issue
Block a user