Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: Export PLATFORM as docker build argument #4489

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ CURRENT_INSTALLER=$(CURRENT_DIR)/installer
INSTALLER_FIRMWARE_DIR=$(INSTALLER)/firmware
CURRENT_FIRMWARE_DIR=$(CURRENT_INSTALLER)/firmware
UBOOT_IMG=$(INSTALLER_FIRMWARE_DIR)/boot
BUILDARGS_FILE=build-args.conf

# not every firmware file is used on every architecture
BIOS_IMG_amd64=$(INSTALLER_FIRMWARE_DIR)/OVMF.fd $(INSTALLER_FIRMWARE_DIR)/OVMF_CODE.fd $(INSTALLER_FIRMWARE_DIR)/OVMF_VARS.fd
Expand Down Expand Up @@ -313,6 +314,7 @@ LINUXKIT_VERSION=v1.5.2
LINUXKIT_SOURCE=https://github.com/linuxkit/linuxkit
LINUXKIT_OPTS=$(if $(strip $(EVE_HASH)),--hash) $(EVE_HASH) $(if $(strip $(EVE_REL)),--release) $(EVE_REL)
LINUXKIT_PKG_TARGET=build
LINUXKIT_BUILD_ARGS=--build-arg-file $(BUILDARGS_FILE)

ifdef LIVE_FAST
# Check the makerootfs.sh and the linuxkit tool invocation, the --input-tar
Expand Down Expand Up @@ -431,7 +433,7 @@ currentversion:
#echo $(shell readlink $(CURRENT) | sed -E 's/rootfs-(.*)\.[^.]*$/\1/')
@cat $(CURRENT_DIR)/installer/eve_version

.PHONY: currentversion linuxkit pkg/kernel
.PHONY: currentversion linuxkit pkg/kernel $(BUILDARGS_FILE)

test: $(LINUXKIT) test-images-patches | $(DIST)
@echo Running tests on $(GOMODULE)
Expand All @@ -455,7 +457,7 @@ pillar-%: $(GOBUILDER) | $(DIST)
$(QUIET): $@: Succeeded

clean:
rm -rf $(DIST) images/out pkg-deps.mk
rm -rf $(DIST) $(BUILDARGS_FILE) images/out pkg-deps.mk

$(DOCKERFILE_FROM_CHECKER): $(DOCKERFILE_FROM_CHECKER_DIR)/*.go $(DOCKERFILE_FROM_CHECKER_DIR)/go.*
make -C $(DOCKERFILE_FROM_CHECKER_DIR)
Expand Down Expand Up @@ -1003,6 +1005,9 @@ else
$(QUIET): $@: Succeeded
endif

$(BUILDARGS_FILE):
@echo "PLATFORM=$(PLATFORM)" > $@

%.yml: %.yml.in $(RESCAN_DEPS) | build-tools
$(QUIET)$(PARSE_PKGS) $< > $@
$(QUIET): $@: Succeeded
Expand All @@ -1024,13 +1029,13 @@ get_pkg_build_rstats_yml = $(if $(wildcard pkg/$1/build-rstats.yml),build-rstats
get_pkg_build_kubevirt_yml = $(if $(and $(filter y,$(DEV)),$(wildcard pkg/$1/build-kubevirt-dev.yml)),build-kubevirt-dev.yml, \
$(if $(wildcard pkg/$1/build-kubevirt.yml),build-kubevirt.yml,build.yml))

eve-%: pkg/%/Dockerfile build-tools $(RESCAN_DEPS)
eve-%: pkg/%/Dockerfile build-tools $(BUILDARGS_FILE) $(RESCAN_DEPS)
$(QUIET): "$@: Begin: LINUXKIT_PKG_TARGET=$(LINUXKIT_PKG_TARGET)"
$(eval LINUXKIT_DOCKER_LOAD := $(if $(filter $(PKGS_DOCKER_LOAD),$*),--docker,))
$(eval LINUXKIT_BUILD_PLATFORMS_LIST := $(call uniq,linux/$(ZARCH) $(if $(filter $(PKGS_HOSTARCH),$*),linux/$(HOSTARCH),)))
$(eval LINUXKIT_BUILD_PLATFORMS := --platforms $(subst $(space),$(comma),$(strip $(LINUXKIT_BUILD_PLATFORMS_LIST))))
$(eval LINUXKIT_FLAGS := $(if $(filter manifest,$(LINUXKIT_PKG_TARGET)),,$(FORCE_BUILD) $(LINUXKIT_DOCKER_LOAD) $(LINUXKIT_BUILD_PLATFORMS)))
$(QUIET)$(LINUXKIT) $(DASH_V) pkg $(LINUXKIT_PKG_TARGET) $(LINUXKIT_OPTS) $(LINUXKIT_FLAGS) --build-yml $(call get_pkg_build_yml,$*) pkg/$*
$(QUIET)$(LINUXKIT) $(DASH_V) pkg $(LINUXKIT_PKG_TARGET) $(LINUXKIT_BUILD_ARGS) $(LINUXKIT_OPTS) $(LINUXKIT_FLAGS) --build-yml $(call get_pkg_build_yml,$*) pkg/$*
$(QUIET)if [ -n "$(PRUNE)" ]; then \
$(LINUXKIT) pkg builder prune; \
docker image prune -f; \
Expand Down
Loading