From 385183d7cd0f470758a258dca102cc96a077c019 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Wed, 7 Feb 2024 17:58:04 +0100 Subject: [PATCH] build matchbox ready image Signed-off-by: Andrei Kvapil --- .dockerignore | 1 + README.md | 120 +++++++++--------- manifests/cozystack-installer.yaml | 4 +- packages/core/installer/Makefile | 32 ++++- .../{talos => installer}/hack/gen-profiles.sh | 6 +- .../{talos => installer}/hack/gen-versions.sh | 0 packages/core/installer/images/installer.json | 6 +- packages/core/installer/images/matchbox.json | 14 ++ packages/core/installer/images/matchbox.tag | 1 + .../core/installer/images/matchbox/Dockerfile | 6 + .../images/matchbox/groups/default.json | 5 + .../images/matchbox/profiles/default.json | 18 +++ .../images}/talos/profiles/initramfs.yaml | 0 .../images}/talos/profiles/installer.yaml | 0 .../images}/talos/profiles/iso.yaml | 0 .../images}/talos/profiles/kernel.yaml | 0 packages/core/talos/Makefile | 15 --- 17 files changed, 141 insertions(+), 87 deletions(-) create mode 100644 .dockerignore rename packages/core/{talos => installer}/hack/gen-profiles.sh (94%) rename packages/core/{talos => installer}/hack/gen-versions.sh (100%) create mode 100644 packages/core/installer/images/matchbox.json create mode 100644 packages/core/installer/images/matchbox.tag create mode 100644 packages/core/installer/images/matchbox/Dockerfile create mode 100644 packages/core/installer/images/matchbox/groups/default.json create mode 100644 packages/core/installer/images/matchbox/profiles/default.json rename packages/core/{ => installer/images}/talos/profiles/initramfs.yaml (100%) rename packages/core/{ => installer/images}/talos/profiles/installer.yaml (100%) rename packages/core/{ => installer/images}/talos/profiles/iso.yaml (100%) rename packages/core/{ => installer/images}/talos/profiles/kernel.yaml (100%) delete mode 100644 packages/core/talos/Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c1d18d8a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +_out diff --git a/README.md b/README.md index fdc82dd9..fac84d9f 100644 --- a/README.md +++ b/README.md @@ -32,56 +32,14 @@ Any Linux system installed on it (eg. Ubuntu should be enough) ### Netboot server -Write configuration: +Start matchbox with prebuilt Talos image for Cozystack: ``` -mkdir -p matchbox/assets matchbox/groups matchbox/profiles - -wget -O matchbox/assets/initramfs.xz \ - https://github.com/aenix-io/cozystack/releases/download/v0.0.1/initramfs-metal-amd64.xz -wget -O matchbox/assets/vmlinuz \ - https://github.com/aenix-io/cozystack/releases/download/v0.0.1/kernel-amd64 - - -cat > matchbox/groups/default.json < matchbox/profiles/default.json < images/installer.tag + +image-talos: + test -f ../../../_out/assets/installer-amd64.tar || make talos-installer + docker load -i ../../../_out/assets/installer-amd64.tar + docker tag ghcr.io/siderolabs/installer:$(TALOS_VERSION) ghcr.io/aenix-io/cozystack/talos:$(TALOS_VERSION) + docker push ghcr.io/aenix-io/cozystack/talos:$(TALOS_VERSION) + +image-matchbox: + test -f ../../../_out/assets/kernel-amd64 || make talos-kernel + test -f ../../../_out/assets/initramfs-metal-amd64.xz || make talos-initramfs + docker buildx build -f images/matchbox/Dockerfile ../../.. \ + --provenance false \ + --tag $(REGISTRY)/matchbox:$(TAG) \ + --cache-from type=registry,ref=$(REGISTRY)/matchbox:$(TAG) \ + --cache-to type=inline \ + --metadata-file images/matchbox.json \ + --push=$(PUSH) \ + --load=$(LOAD) + echo "$(REGISTRY)/matchbox:$(TAG)" > images/matchbox.tag + +assets: talos-iso + +talos-initramfs talos-kernel talos-installer talos-iso: + cat images/talos/profiles/$(subst talos-,,$@).yaml | docker run --rm -i -v $${PWD}/../../../_out/assets:/out -v /dev:/dev --privileged "ghcr.io/siderolabs/imager:$(TALOS_VERSION)" - diff --git a/packages/core/talos/hack/gen-profiles.sh b/packages/core/installer/hack/gen-profiles.sh similarity index 94% rename from packages/core/talos/hack/gen-profiles.sh rename to packages/core/installer/hack/gen-profiles.sh index 3423ee58..409e0f28 100755 --- a/packages/core/talos/hack/gen-profiles.sh +++ b/packages/core/installer/hack/gen-profiles.sh @@ -6,7 +6,7 @@ PROFILES="initramfs kernel iso installer" FIRMWARES="amd-ucode amdgpu-firmware bnx2-bnx2x i915-ucode intel-ice-firmware intel-ucode qlogic-firmware" EXTENSIONS="drbd zfs" -mkdir -p profiles +mkdir -p images/talos/profiles printf "fetching talos version: " talos_version=${1:-$(skopeo --override-os linux --override-arch amd64 list-tags docker://ghcr.io/siderolabs/imager | jq -r '.Tags[]' | grep '^v[0-9]\+.[0-9]\+.[0-9]\+$' | sort -V | tail -n 1)} @@ -31,8 +31,8 @@ for extension in $EXTENSIONS; do done for profile in $PROFILES; do - echo "writing profile profiles/$profile.yaml" - cat > profiles/$profile.yaml < images/talos/profiles/$profile.yaml <