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

Properly scope Docker build flags for build-harness project #370

Merged
merged 1 commit into from
Jan 26, 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
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,37 @@
ifeq ($(BUILD_HARNESS_TOP_LEVEL_MAKEFILE_GUARD),)
BUILD_HARNESS_TOP_LEVEL_MAKEFILE_GUARD := included

########################################################################################
## BEWARE: These variables are used by default by ALL PROJECTS that use Build Harness ##
## See the section below for variables that are specific to this project ##
########################################################################################

export OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
export BUILD_HARNESS_PATH ?= $(shell 'pwd')
export BUILD_HARNESS_EXTENSIONS_PATH ?= $(BUILD_HARNESS_PATH)/../build-harness-extensions
export BUILD_HARNESS_OS ?= $(OS)
export BUILD_HARNESS_ARCH ?= $(shell uname -m | sed 's/x86_64/amd64/g')
export SELF ?= $(MAKE)
export PATH := $(BUILD_HARNESS_PATH)/vendor:$(PATH)
# We do not have Alpine packages for arm64, so we need to force amd64 until we switch to Debian
export DOCKER_BUILD_FLAGS ?= --platform linux/amd64

# Forces auto-init off to avoid invoking the macro on recursive $(MAKE)
export BUILD_HARNESS_AUTO_INIT := false

# Debug should not be defaulted to a value because some cli consider any value as `true` (e.g. helm)
export DEBUG ?=


#############################################################################
## SAFE: These variables are used only when building build-harness itself, ##
## so these are relatively safe to change ##
#############################################################################
ifeq ($(CURDIR),$(realpath $(BUILD_HARNESS_PATH)))
# Only execute this section if we're actually in the `build-harness` project itself
# List of targets the `readme` target should call before generating the readme
export README_DEPS ?= docs/targets.md auto-label
export DEFAULT_HELP_TARGET = help/all
# We do not have Alpine packages for arm64, so we need to force amd64 until we switch to Debian
export DOCKER_BUILD_FLAGS ?= --platform linux/amd64

auto-label: MODULES=$(filter %/, $(sort $(wildcard modules/*/)))
auto-label:
Expand All @@ -36,6 +46,8 @@ auto-label:
# builder/build is defined in templates/Makefile.build-harness
build: builder/build

else
export DOCKER_BUILD_FLAGS ?=
endif

# Import Makefiles into current context
Expand Down
Loading