Skip to content

Commit

Permalink
makefile: prevent passing an unknown --arch argument to docker
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
phlogistonjohn authored and mergify[bot] committed Jun 22, 2023
1 parent fa27f06 commit 05d46b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ get_imagename=$(firstword $(subst :, ,$1))
get_pkgsource=$(if $(findstring nightly,$1),nightly,default)


arch_flag=$(strip $(if $(filter docker,$(CONTAINER_CMD)),\
$(if $(filter-out $(HOST_ARCH),$(BUILD_ARCH)),\
$(error Setting BUILD_ARCH != $(HOST_ARCH) not supported on docker)),\
$(if $(BUILD_ARCH),--arch $(BUILD_ARCH))))

build: build-server build-nightly-server build-ad-server build-client \
build-toolbox
.PHONY: build
Expand Down Expand Up @@ -305,7 +310,7 @@ check-gitlint: $(filter $(ALT_BIN)%,$(GITLINT))
_img_build: $(DIR)/.common
$(BUILD_CMD) \
$(BUILD_ARGS) \
$(if $(filter-out $(HOST_ARCH),$(BUILD_ARCH)),--arch $(BUILD_ARCH)) \
$(call arch_flag) \
$(EXTRA_BUILD_ARGS) \
--tag $(SHORT_NAME) \
--tag $(REPO_NAME) \
Expand Down

0 comments on commit 05d46b8

Please sign in to comment.