From 0e4681055a2267bf5eeebb49b9df5f1595243331 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Thu, 22 Feb 2024 04:11:17 -0700 Subject: [PATCH] Make build ARCH-aware Signed-off-by: Bjorn Neergaard (cherry picked from commit 58d04e26de173d27520be5f8d31d3287deaa7485) Signed-off-by: Sebastiaan van Stijn --- Jenkinsfile | 2 +- Makefile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b67573e9..b23aae45 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ def generatePackageStep(opts, arch) { ''' checkout scm sh 'make clean' - sh "make CREATE_ARCHIVE=1 ${opts.image}" + sh "make CREATE_ARCHIVE=1 ARCH=${arch} ${opts.image}" archiveArtifacts(artifacts: 'archive/*.tar.gz', onlyIfSuccessful: true) } finally { deleteDir() diff --git a/Makefile b/Makefile index e51c3763..ff220287 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ include common/common.mk +ARCH=$(shell uname -m) BUILD_IMAGE=ubuntu:focal BUILD_TYPE=$(shell ./scripts/deb-or-rpm $(BUILD_IMAGE)) BUILD_BASE=$(shell ./scripts/determine-base $(BUILD_IMAGE)) @@ -84,7 +85,7 @@ build: @echo "" @echo "containerd : $(REF) (commit: $(shell git -C "src/github.com/containerd/containerd" log -1 --pretty='%h'))" @echo "runc : $$(./scripts/determine-runc-version) (commit: $$(git -C "src/github.com/opencontainers/runc" log -1 --pretty='%h'))" - @echo "architecture : $(shell uname -m)" + @echo "architecture : $(ARCH)" @echo "build image : $(BUILD_IMAGE)" @echo "golang image : $(GOLANG_IMAGE)" @echo "--------------------------------------------------------------------" @@ -96,6 +97,7 @@ build: @set -x; DOCKER_BUILDKIT=1 docker build \ --pull \ + --platform linux/$(ARCH) \ --build-arg GOLANG_IMAGE="$(GOLANG_IMAGE)" \ --build-arg BUILD_IMAGE="$(BUILD_IMAGE)" \ --build-arg BASE="$(BUILD_BASE)" \