From d019305f298013d46cdf133e934c29ac27d97d5c Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Thu, 10 Nov 2022 05:14:29 +0000 Subject: [PATCH] Don't build container images: EKSA build environment doesn't have docker so build containers via the makefile will fail. Signed-off-by: Jacob Weinstock --- rules.mk | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/rules.mk b/rules.mk index b2c5133..006dd48 100644 --- a/rules.mk +++ b/rules.mk @@ -5,8 +5,6 @@ MAKEFLAGS += --no-builtin-rules # This avoids a failure to then skip building on next run if the output is created by shell redirection for example # Not really necessary for now, but just good to have already if it becomes necessary later. .DELETE_ON_ERROR: -# Treat the whole recipe as a one shell script/invocation instead of one-per-line -.ONESHELL: # Use bash instead of plain sh SHELL := bash .SHELLFLAGS := -o pipefail -euc @@ -14,30 +12,30 @@ SHELL := bash # This option is for running docker manifest command export DOCKER_CLI_EXPERIMENTAL := enabled -ARCH := $(shell uname -m) +ARCH:=$(shell uname -m) ifeq ($(ARCH),x86_64) -ARCH = amd64 +ARCH=amd64 endif ifeq ($(ARCH),aarch64) -ARCH = arm64 +ARCH=arm64 endif -arches := amd64 arm64 -modes := rel dbg +arches:=amd64 arm64 +modes:=rel dbg -hook-bootkit-deps := $(wildcard hook-bootkit/*) -hook-docker-deps := $(wildcard hook-docker/*) +hook-bootkit-deps:=$(wildcard hook-bootkit/*) +hook-docker-deps:=$(wildcard hook-docker/*) define foreach_mode_arch_rules = -mode := $(1) -arch := $(2) +mode:=$(1) +arch:=$(2) $$(shell mkdir -p out/$T/$(mode)/$(arch)) .PHONY: image-$(mode)-$(arch) image-$(mode)-$(arch): out/$T/$(mode)/$(arch)/hook.tar -out/$T/$(mode)/$(arch)/hook.tar: out/$T/$(mode)/$(arch)/hook.yaml out/$T/hook-bootkit-$(arch) out/$T/hook-docker-$(arch) +out/$T/$(mode)/$(arch)/hook.tar: out/$T/$(mode)/$(arch)/hook.yaml linuxkit build -docker -arch $(arch) -format tar-kernel-initrd -name hook -dir $$(@D) $$< mv $$(@D)/hook-initrd.tar $$@ @@ -46,15 +44,12 @@ out/$T/$(mode)/$(arch)/cmdline out/$T/$(mode)/$(arch)/initrd.img out/$T/$(mode)/ touch $$@ out/$T/$(mode)/$(arch)/hook.yaml: $$(LINUXKIT_CONFIG) - sed '/hook-\(bootkit\|docker\):/ { s|:latest|:$T-$(arch)|; s|quay.io/tinkerbell|$(ORG)|; }' $$< > $$@ - if [[ $(mode) == dbg ]]; then - sed -i '/^\s*#dbg/ s|#dbg||' $$@ - fi + sed -E -e 's,quay.io/tinkerbell/hook-(bootkit|docker|kernel).*,$(IMAGE_REPO)/tinkerbell/hook-\1:$(LATEST_TAG),g' $$< > $$@ endef $(foreach m,$(modes),$(foreach a,$(arches),$(eval $(call foreach_mode_arch_rules,$m,$a)))) define foreach_arch_rules = -arch := $(1) +arch:=$(1) debug: dbg-image-$(arch) dbg-image-$(arch): out/$T/dbg/$(arch)/hook.tar @@ -90,14 +85,14 @@ push-hook-bootkit push-hook-docker: dist: out/$T/rel/amd64/hook.tar out/$T/rel/arm64/hook.tar ## Build tarballs for distribution dbg-dist: out/$T/dbg/$(ARCH)/hook.tar ## Build debug enabled tarball dist dbg-dist: - for f in $^; do - case $$f in - *amd64*) arch=x86_64 ;; - *arm64*) arch=aarch64 ;; - *) echo unknown arch && exit 1;; - esac - d=$$(dirname $$(dirname $$f)) - tar -xf $$f -C $$d/ kernel && mv $$d/kernel $$d/vmlinuz-$$arch - tar -xf $$f -C $$d/ initrd.img && mv $$d/initrd.img $$d/initramfs-$$arch - tar -cf- -C $$d initramfs-$$arch vmlinuz-$$arch | pigz > $$d/hook_$$arch.tar.gz - done + for f in $^; do \ + case $$f in \ + *amd64*) arch=x86_64 ;; \ + *arm64*) arch=aarch64 ;; \ + *) echo unknown arch && exit 1;; \ + esac; \ + d=$$(dirname $$(dirname $$f)); \ + tar -xf $$f -C $$d/ kernel && mv $$d/kernel $$d/vmlinuz-$$arch; \ + tar -xf $$f -C $$d/ initrd.img && mv $$d/initrd.img $$d/initramfs-$$arch; \ + tar -cf- -C $$d initramfs-$$arch vmlinuz-$$arch | pigz > $$d/hook_$$arch.tar.gz; \ + done \ -- 2.36.0