From b54b892f26977461032c642b1e236ecd3ae635fc Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Sun, 7 Jul 2024 19:00:57 +0200 Subject: [PATCH] Pass build description labels to podman build The Compose Specification supports adding labels to the build image which is also used in practice. Support this and pass the labels to `podman build`. Signed-off-by: Sebastian Wick --- podman_compose.py | 2 ++ tests/integration/build/README.md | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index ec6471c..e5ba8d6 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -2378,6 +2378,8 @@ async def build_one(compose, args, cnt): build_args.extend(get_secret_args(compose, cnt, secret, podman_is_building=True)) for tag in build_desc.get("tags", []): build_args.extend(["-t", tag]) + for label in build_desc.get("labels", []): + build_args.extend(["--label", label]) for additional_ctx in build_desc.get("additional_contexts", {}): build_args.extend([f"--build-context={additional_ctx}"]) if "target" in build_desc: diff --git a/tests/integration/build/README.md b/tests/integration/build/README.md index e67b421..b8b260a 100644 --- a/tests/integration/build/README.md +++ b/tests/integration/build/README.md @@ -21,5 +21,3 @@ ALT buildno=2 port 8000 2019-09-03T15:16:38+0000 as you can see we were able to override buildno to be 2 instead of 1, and httpd_port to 8000. - -NOTE: build labels are not passed to `podman build`