Skip to content

Commit

Permalink
Allow users to overwrite build platforms
Browse files Browse the repository at this point in the history
This commit modifies the Makefile to make platforms stored in a variable,
which can be adjusted by users as needed. For instance, if a user is
only interested in amd64 builds, they can use:

`PLATFORMS=linux/amd64 make all-images`

Signed-off-by: Ryan Drew <[email protected]>
  • Loading branch information
learnitall authored and tklauser committed Mar 20, 2024
1 parent 43f9da5 commit 0ee97a0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ REGISTRIES ?= quay.io/cilium

PUSH ?= false
EXPORT ?= false
PLATFORMs ?= linux/amd64,linux/arm64

all-images: lint maker-image update-maker-image tester-image update-tester-image compilers-image update-compilers-image bpftool-image llvm-image network-perf-image

lint:
scripts/lint.sh

.buildx_builder:
docker buildx create --platform linux/amd64,linux/arm64 --buildkitd-flags '--debug' > $@
docker buildx create --platform $(PLATFORMS) --buildkitd-flags '--debug' > $@

update-alpine-base-image:
scripts/update-alpine-base-image.sh
Expand All @@ -24,43 +25,43 @@ update-ubuntu-image:
scripts/update-ubuntu-image.sh

maker-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh image-maker images/maker linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh image-maker images/maker $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

update-maker-image:
scripts/update-maker-image.sh $(firstword $(REGISTRIES))

tester-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh image-tester images/tester linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh image-tester images/tester $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

update-tester-image:
scripts/update-tester-image.sh $(firstword $(REGISTRIES))

compilers-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh image-compilers images/compilers linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh image-compilers images/compilers $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

update-compilers-image:
scripts/update-compilers-image.sh $(firstword $(REGISTRIES))

bpftool-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh cilium-bpftool images/bpftool linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh cilium-bpftool images/bpftool $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

llvm-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh cilium-llvm images/llvm linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) TEST=true scripts/build-image.sh cilium-llvm images/llvm $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

ca-certificates-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh ca-certificates images/ca-certificates linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh ca-certificates images/ca-certificates $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

startup-script-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh startup-script images/startup-script linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh startup-script images/startup-script $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

checkpatch-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh cilium-checkpatch images/checkpatch linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh cilium-checkpatch images/checkpatch $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

network-perf-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh network-perf images/network-perf linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh network-perf images/network-perf $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

iptables-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh iptables images/iptables linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh iptables images/iptables $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

iptables-20.04-image: .buildx_builder
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh iptables-20.04 images/iptables-20.04 linux/amd64,linux/arm64 "$$(cat .buildx_builder)" $(REGISTRIES)
PUSH=$(PUSH) EXPORT=$(EXPORT) scripts/build-image.sh iptables-20.04 images/iptables-20.04 $(PLATFORMS) "$$(cat .buildx_builder)" $(REGISTRIES)

0 comments on commit 0ee97a0

Please sign in to comment.