Skip to content

Commit 3f86750

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
hack: don't pass --arch to podman when target and host arch matches
Avoid some minor stumbling blocks during the release process when building the toolbox image by not passing --arch to podman when the target architecture matches. Signed-off-by: John Mulligan <[email protected]>
1 parent 1e99a87 commit 3f86750

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

hack/build-image

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ import sys
4848

4949
logger = logging.getLogger("build-image")
5050

51+
# Set FORCE_ARCH_FLAG if you want to test passing the --arch flag to podman all
52+
# the time. This was the previous behavior but we found it to have some issues.
53+
# When this is false the --arch flag is passed to podman ONLY when the target
54+
# arch != the host system arch.
55+
FORCE_ARCH_FLAG = False
56+
5157
# IMAGE_KINDS - map aliases/names to canonical names for the kinds
5258
# of images we can build
5359
IMG_SERVER = "samba-server"
@@ -196,7 +202,13 @@ def container_build(cli, target):
196202
if "docker" in args[0]:
197203
if target.arch != host_arch():
198204
raise RuntimeError("Docker does not support --arch")
199-
else:
205+
elif target.arch != host_arch() or FORCE_ARCH_FLAG:
206+
# We've noticed a few small quirks when using podman with the --arch
207+
# option. The main issue is that building the client image works
208+
# but then the toolbox image fails because it somehow doesn't see
209+
# the image we just built as usable. This doesn't happen when
210+
# --arch is not provided. So if the target arch and the host_arch
211+
# are the same, skip passing the extra argument.
200212
args.append(f"--arch={target.arch}")
201213
if cli.extra_build_arg:
202214
args.extend(cli.extra_build_arg)

0 commit comments

Comments
 (0)