Skip to content

Commit

Permalink
Make sure we have correct buildx builder
Browse files Browse the repository at this point in the history
Our build may depend on buildx features e.g. --sbom so we need to make
sure we have a correct builder version. This is not a big problem for
local build but a big one for GH runners.

Signed-off-by: Mikhail Malyshev <[email protected]>
(cherry picked from commit ae347d3)
Signed-off-by: Mikhail Malyshev <[email protected]>
  • Loading branch information
rucoder committed Mar 5, 2024
1 parent 8f0a984 commit 594f236
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Makefile.eve
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ LINUXKIT_VERSION=58c36c9eb0c32acf66ae7877d18a9ad24d59d73e
GOBIN=/tmp/linuxkit-$(LINUXKIT_VERSION)
LK=$(GOBIN)/linuxkit

BUILD_KIT_VERSION=v0.12.5
BUILD_KIT_BUILDER=eve-kernel-builder-$(BUILD_KIT_VERSION)

SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct)
BRANCH=eve-kernel-$(ARCHITECTURE)-$(KERNEL_TAG)-$(EVE_FLAVOR)
# make sure we get a date in correct format, otherwise initramfs cpio mtime will be variable
Expand Down Expand Up @@ -47,16 +50,23 @@ help: Makefile
@echo " clean: remove generated files"
@echo

.PHONY: ensure-builder
ensure-builder:
docker buildx inspect $(BUILD_KIT_BUILDER) 2>/dev/null || \
docker buildx create --name $(BUILD_KIT_BUILDER) \
--driver docker-container --bootstrap --driver-opt=image=moby/buildkit:$(BUILD_KIT_VERSION)

.PHONY: linuxkit
linuxkit: $(LK)
$(LK):
GOBIN=$(GOBIN) go install github.com/linuxkit/linuxkit/src/cmd/linuxkit@$(LINUXKIT_VERSION)

KERNEL_OCI_FILE:=$(shell mktemp -u)-kernel.tar

kernel-build-%: Makefile.eve linuxkit
kernel-build-%: Makefile.eve linuxkit | ensure-builder
@echo "Building kernel version $(BRANCH):$(VERSION)-$* with compiler $*"
docker buildx build \
--builder=$(BUILD_KIT_BUILDER) \
--build-arg="SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH)" \
--build-arg="KBUILD_BUILD_TIMESTAMP=$(KBUILD_BUILD_TIMESTAMP)" \
--build-arg="LOCALVERSION=$(VERSION)$(DIRTY)" \
Expand Down

0 comments on commit 594f236

Please sign in to comment.