Skip to content

Commit 05d46b8

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
makefile: prevent passing an unknown --arch argument to docker
Assert that if the CONTAINER_CMD is docker that the --arch flag will not be passed to the container engine. Only pass an --arch flag (to podman) if BUILD_ARCH is set to some non-empty value. Signed-off-by: John Mulligan <[email protected]>
1 parent fa27f06 commit 05d46b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ get_imagename=$(firstword $(subst :, ,$1))
115115
get_pkgsource=$(if $(findstring nightly,$1),nightly,default)
116116

117117

118+
arch_flag=$(strip $(if $(filter docker,$(CONTAINER_CMD)),\
119+
$(if $(filter-out $(HOST_ARCH),$(BUILD_ARCH)),\
120+
$(error Setting BUILD_ARCH != $(HOST_ARCH) not supported on docker)),\
121+
$(if $(BUILD_ARCH),--arch $(BUILD_ARCH))))
122+
118123
build: build-server build-nightly-server build-ad-server build-client \
119124
build-toolbox
120125
.PHONY: build
@@ -305,7 +310,7 @@ check-gitlint: $(filter $(ALT_BIN)%,$(GITLINT))
305310
_img_build: $(DIR)/.common
306311
$(BUILD_CMD) \
307312
$(BUILD_ARGS) \
308-
$(if $(filter-out $(HOST_ARCH),$(BUILD_ARCH)),--arch $(BUILD_ARCH)) \
313+
$(call arch_flag) \
309314
$(EXTRA_BUILD_ARGS) \
310315
--tag $(SHORT_NAME) \
311316
--tag $(REPO_NAME) \

0 commit comments

Comments
 (0)