From cf54367cbbc02856bfcf7c74acaab26af47bb835 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Wed, 15 Apr 2026 12:36:53 +0200 Subject: [PATCH] Publish platform-specific image lists and bundles Generate image lists per target platform and use the matching list file when building each bundle. Add Makefile targets to build the airgap image list and bundle for Windows 2022, and update the CI workflows to use the new platform-specific artifact names. Upload all the airgap image lists and bundles as release artifacts. Limit IPv6 test image bundles to linux-amd64 and linux-arm64, the platforms on which all required images are available. This changes the naming scheme of the image lists, as they didn't have a platform suffix before. Signed-off-by: Tom Wieczorek --- .github/workflows/build-image-bundle.yml | 29 +++++----- .github/workflows/build-k0s.yml | 36 +++++++++---- .github/workflows/go.yml | 12 ++--- .github/workflows/release.yml | 47 +++++++++++++--- .gitignore | 18 ++++--- Makefile | 68 ++++++++++++++++-------- 6 files changed, 139 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build-image-bundle.yml b/.github/workflows/build-image-bundle.yml index a62998841d..f23a52f855 100644 --- a/.github/workflows/build-image-bundle.yml +++ b/.github/workflows/build-image-bundle.yml @@ -8,14 +8,12 @@ on: inputs: image-bundle-name: type: string + required: true description: The name of the image bundle to be built. - target-os: - type: string - description: The OS to build the image bundle for. - target-arch: + image-bundle-platform: type: string required: true - description: The architecture to build the image bundle for. + description: The platform suffix of the image bundle to be built. outputs: cache-key: description: The image bundle's cache key. @@ -26,13 +24,12 @@ env: jobs: build: - name: "${{ inputs.target-os }}-${{ inputs.target-arch }}" + name: "${{ inputs.image-bundle-name }}-${{ inputs.image-bundle-platform }}" runs-on: ubuntu-24.04 env: IMAGE_BUNDLE_NAME: ${{ inputs.image-bundle-name }} - TARGET_OS: ${{ inputs.target-os }} - TARGET_ARCH: ${{ inputs.target-arch }} + IMAGE_BUNDLE_PLATFORM: ${{ inputs.image-bundle-platform }} steps: - name: "Build :: Checkout" @@ -48,7 +45,7 @@ jobs: - name: "Download :: Image list" uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 with: - name: ${{ inputs.image-bundle-name }}-image-list-${{ inputs.target-os }}-${{ inputs.target-arch }} + name: ${{ inputs.image-bundle-name }}-images-${{ inputs.image-bundle-platform }}.txt # Capture the calculated image bundle source hash in a separate step, as # the hashFiles function is evaluated before the step execution. So all @@ -56,16 +53,16 @@ jobs: - name: "Cache :: Image bundle :: Calculate cache key" id: cache-image-bundle-calc-key env: - HASH_VALUE: ${{ hashFiles('Makefile', format('{0}-images.txt', inputs.image-bundle-name), 'cmd/airgap/*', 'pkg/airgap/*') }} + HASH_VALUE: ${{ hashFiles('Makefile', format('{0}-images-{1}.txt', inputs.image-bundle-name, inputs.image-bundle-platform), 'cmd/airgap/*', 'pkg/airgap/*') }} run: | - printf 'cache-key=build-%s-image-bundle-%s-%s-%s\n' "$IMAGE_BUNDLE_NAME" "$TARGET_OS" "$TARGET_ARCH" "$HASH_VALUE" >> "$GITHUB_OUTPUT" + printf 'cache-key=build-%s-image-bundle-%s-%s\n' "$IMAGE_BUNDLE_NAME" "$IMAGE_BUNDLE_PLATFORM" "$HASH_VALUE" >> "$GITHUB_OUTPUT" - name: "Cache :: Image bundle" id: cache-image-bundle uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: key: ${{ steps.cache-image-bundle-calc-key.outputs.cache-key }} - path: ${{ inputs.image-bundle-name }}-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}.tar + path: ${{ inputs.image-bundle-name }}-image-bundle-${{ inputs.image-bundle-platform }}.tar - name: "Build :: Image bundle" if: steps.cache-image-bundle.outputs.cache-hit != 'true' @@ -74,12 +71,12 @@ jobs: EMBEDDED_BINS_BUILDMODE: none run: | chmod +x k0s - make --touch k0s "$IMAGE_BUNDLE_NAME-images.txt" - make "$IMAGE_BUNDLE_NAME-image-bundle-$TARGET_OS-$TARGET_ARCH.tar" + make --touch k0s "$IMAGE_BUNDLE_NAME-images-$IMAGE_BUNDLE_PLATFORM.txt" + make "$IMAGE_BUNDLE_NAME-image-bundle-$IMAGE_BUNDLE_PLATFORM.tar" - name: "Upload :: Image bundle" uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: - name: ${{ inputs.image-bundle-name }}-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }} - path: ${{ inputs.image-bundle-name }}-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}.tar + name: ${{ inputs.image-bundle-name }}-image-bundle-${{ inputs.image-bundle-platform }} + path: ${{ inputs.image-bundle-name }}-image-bundle-${{ inputs.image-bundle-platform }}.tar compression-level: 0 diff --git a/.github/workflows/build-k0s.yml b/.github/workflows/build-k0s.yml index e6acaa8d4d..1cb9e11d50 100644 --- a/.github/workflows/build-k0s.yml +++ b/.github/workflows/build-k0s.yml @@ -112,26 +112,42 @@ jobs: path: spdx.json - name: "Build :: Airgap image list" - if: inputs.target-os != 'windows' - run: make airgap-images.txt && cat airgap-images.txt + id: build-airgap-image-list + env: + TARGET_OS: ${{ inputs.target-os }} + TARGET_ARCH: ${{ inputs.target-arch }} + run: | + target=$TARGET_OS-$TARGET_ARCH + if [ $TARGET_OS = windows ]; then + target=windows2022-$TARGET_ARCH + fi + target=airgap-images-$target.txt + make $target && cat $target + echo file-name="$target" >>"$GITHUB_OUTPUT" - name: "Upload :: Airgap image list" - if: inputs.target-os != 'windows' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: - name: airgap-image-list-${{ inputs.target-os }}-${{ inputs.target-arch }} - path: airgap-images.txt + name: ${{ steps.build-airgap-image-list.outputs.file-name }} + path: ${{ steps.build-airgap-image-list.outputs.file-name }} - name: "Build :: IPv6 test image list" - if: inputs.target-os != 'windows' - run: make ipv6-test-images.txt && cat ipv6-test-images.txt + id: build-ipv6-test-image-list + if: inputs.target-os == 'linux' && (inputs.target-arch == 'amd64' || inputs.target-arch == 'arm64') + env: + TARGET_OS: ${{ inputs.target-os }} + TARGET_ARCH: ${{ inputs.target-arch }} + run: | + target=ipv6-test-images-$TARGET_OS-$TARGET_ARCH.txt + make $target && cat $target + echo file-name="$target" >>"$GITHUB_OUTPUT" - name: "Upload :: IPv6 test image list" - if: inputs.target-os != 'windows' + if: steps.build-ipv6-test-image-list.outcome == 'success' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: - name: ipv6-test-image-list-${{ inputs.target-os }}-${{ inputs.target-arch }} - path: ipv6-test-images.txt + name: ${{ steps.build-ipv6-test-image-list.outputs.file-name }} + path: ${{ steps.build-ipv6-test-image-list.outputs.file-name }} - name: "Cache :: Go cache :: Trim" if: steps.cache-gocache.outputs.cache-hit diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d199a97748..9114191120 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -120,8 +120,7 @@ jobs: uses: ./.github/workflows/build-image-bundle.yml with: image-bundle-name: airgap - target-os: linux - target-arch: ${{ matrix.target-arch }} + image-bundle-platform: linux-${{ matrix.target-arch }} build-ipv6-test-image-bundle: name: "Build :: IPv6 test image bundle" @@ -129,8 +128,7 @@ jobs: uses: ./.github/workflows/build-image-bundle.yml with: image-bundle-name: ipv6-test - target-os: linux - target-arch: amd64 + image-bundle-platform: linux-amd64 submit-sbom: name: "Submit :: SBOM" @@ -358,15 +356,15 @@ jobs: run: make check-unit - name: Create airgap image list - run: make airgap-images.txt + run: make airgap-images-linux-arm.txt - name: Cache airgap image bundle id: cache-airgap-image-bundle uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: - key: airgap-image-bundle-linux-arm-${{ hashFiles('Makefile', 'airgap-images.txt', 'cmd/airgap/*', 'pkg/airgap/*') }} + key: airgap-image-bundle-linux-arm-${{ hashFiles('Makefile', 'airgap-images-linux-arm.txt', 'cmd/airgap/*', 'pkg/airgap/*') }} path: | - airgap-images.txt + airgap-images-linux-arm.txt airgap-image-bundle-linux-arm.tar - name: Create airgap image bundle if not cached diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45c72814db..798b5995fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -134,8 +134,7 @@ jobs: uses: shogo82148/actions-upload-release-asset@96bc1f0cb850b65efd58a6b5eaa0a69f88d38077 # v1.10.0 with: upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./airgap-images.txt - asset_name: airgap-images-list.txt + asset_path: ./airgap-images-linux-amd64.txt asset_content_type: text/plain - name: Upload Release Assets - Signature @@ -178,8 +177,8 @@ jobs: with: upload_url: ${{ needs.release.outputs.upload_url }} asset_path: ./airgap-image-bundle-linux-amd64.tar - asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-amd64 - asset_content_type: application/octet-stream + asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-linux-amd64.tar + asset_content_type: application/x-tar - name: Clean Docker after build if: always() @@ -233,6 +232,9 @@ jobs: env: VERSION: ${{ needs.release.outputs.tag_name }} + - name: Create airgap image bundle + run: make airgap-image-bundle-windows2022-amd64.tar + - name: Sign binary env: COSIGN_KEY: ${{ secrets.COSIGN_KEY }} @@ -254,6 +256,13 @@ jobs: asset_name: k0s-${{ needs.release.outputs.tag_name }}-amd64.exe asset_content_type: application/octet-stream + - name: Upload Release Assets - Airgap Image List + uses: shogo82148/actions-upload-release-asset@96bc1f0cb850b65efd58a6b5eaa0a69f88d38077 # v1.10.0 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./airgap-images-windows2022-amd64.txt + asset_content_type: text/plain + - name: Upload Release Assets - Signature uses: shogo82148/actions-upload-release-asset@96bc1f0cb850b65efd58a6b5eaa0a69f88d38077 # v1.10.0 with: @@ -262,6 +271,14 @@ jobs: asset_name: k0s-${{ needs.release.outputs.tag_name }}-amd64.exe.sig asset_content_type: application/octet-stream + - name: Upload Release Assets - Bundle + uses: shogo82148/actions-upload-release-asset@96bc1f0cb850b65efd58a6b5eaa0a69f88d38077 # v1.10.0 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./airgap-image-bundle-windows2022-amd64.tar + asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-windows2022-amd64.tar + asset_content_type: application/x-tar + - name: Clean Docker after build if: always() run: | @@ -369,13 +386,20 @@ jobs: name: k0s-linux-arm64 path: ./k0s + - name: Upload Release Assets - Airgap image list + uses: shogo82148/actions-upload-release-asset@96bc1f0cb850b65efd58a6b5eaa0a69f88d38077 # v1.10.0 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./airgap-images-linux-arm64.txt + asset_content_type: text/plain + - name: Upload Release Assets - Bundle uses: shogo82148/actions-upload-release-asset@96bc1f0cb850b65efd58a6b5eaa0a69f88d38077 # v1.10.0 with: upload_url: ${{ needs.release.outputs.upload_url }} asset_path: ./airgap-image-bundle-linux-arm64.tar - asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-arm64 - asset_content_type: application/octet-stream + asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-linux-arm64.tar + asset_content_type: application/x-tar - name: Clean Docker after build if: always() @@ -476,13 +500,20 @@ jobs: name: k0s-linux-arm path: ./k0s + - name: Upload Release Assets - Airgap image list + uses: shogo82148/actions-upload-release-asset@62365f23c0419a04b7161371be3fe0be0893ab10 # v1.8.2 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./airgap-images-linux-arm.txt + asset_content_type: text/plain + - name: Upload Release Assets - Bundle uses: shogo82148/actions-upload-release-asset@62365f23c0419a04b7161371be3fe0be0893ab10 # v1.8.2 with: upload_url: ${{ needs.release.outputs.upload_url }} asset_path: ./airgap-image-bundle-linux-arm.tar - asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-arm - asset_content_type: application/octet-stream + asset_name: k0s-airgap-bundle-${{ needs.release.outputs.tag_name }}-linux-arm.tar + asset_content_type: application/x-tar - name: Clean Docker after build if: always() diff --git a/.gitignore b/.gitignore index 901d43dfd2..3921e91e08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,20 @@ -/airgap-images.txt /airgap-image-bundle-linux-amd64.tar -/airgap-image-bundle-linux-arm64.tar /airgap-image-bundle-linux-arm.tar +/airgap-image-bundle-linux-arm64.tar /airgap-image-bundle-linux-riscv64.tar -/ipv6-test-images.txt -/ipv6-test-image-bundle-linux-amd64.tar -/ipv6-test-image-bundle-linux-arm64.tar -/ipv6-test-image-bundle-linux-arm.tar -/ipv6-test-image-bundle-linux-riscv64.tar +/airgap-image-bundle-windows2022-amd64.tar +/airgap-images-linux-amd64.txt +/airgap-images-linux-arm.txt +/airgap-images-linux-arm64.txt +/airgap-images-linux-riscv64.txt +/airgap-images-windows2022-amd64.txt /build/cache/* /embedded-binaries-linux.zip /embedded-binaries-windows.zip +/ipv6-test-image-bundle-linux-amd64.tar +/ipv6-test-image-bundle-linux-arm64.tar +/ipv6-test-images-linux-amd64.txt +/ipv6-test-images-linux-arm64.txt /k0s /k0s.bare /k0s.exe diff --git a/Makefile b/Makefile index 35d87eda1c..941f49df13 100644 --- a/Makefile +++ b/Makefile @@ -299,21 +299,39 @@ lint-go: $(GO_ENV_REQUISITES) go.sum .PHONY: lint lint: lint-copyright lint-go -airgap-images.txt: k0s $(GO_ENV_REQUISITES) - $(GO_ENV) ./k0s airgap list-images --all > '$@' +airgap-images-linux-amd64.txt airgap-image-bundle-linux-amd64.tar: TARGET_PLATFORM := linux/amd64 +airgap-images-linux-arm64.txt airgap-image-bundle-linux-arm64.tar: TARGET_PLATFORM := linux/arm64 +airgap-images-linux-arm.txt airgap-image-bundle-linux-arm.tar: TARGET_PLATFORM := linux/arm/v7 +airgap-images-linux-riscv64.txt airgap-image-bundle-linux-riscv64.tar: TARGET_PLATFORM := linux/riscv64 +airgap-images-windows2022-amd64.txt airgap-image-bundle-windows2022-amd64.tar: TARGET_PLATFORM := windows(10.0.20348)/amd64 + +airgap-images-linux-amd64.txt \ +airgap-images-linux-arm64.txt \ +airgap-images-linux-arm.txt \ +airgap-images-linux-riscv64.txt \ +airgap-images-windows2022-amd64.txt: k0s $(GO_ENV_REQUISITES) + $(GO_ENV) ./k0s airgap list-images --all --platform='$(TARGET_PLATFORM)' > '$@' + +airgap-image-bundle-linux-amd64.tar: airgap-images-linux-amd64.txt +airgap-image-bundle-linux-arm64.tar: airgap-images-linux-arm64.txt +airgap-image-bundle-linux-arm.tar: airgap-images-linux-arm.txt +airgap-image-bundle-linux-riscv64.tar: airgap-images-linux-riscv64.txt +airgap-image-bundle-windows2022-amd64.tar: airgap-images-windows2022-amd64.txt -airgap-image-bundle-linux-amd64.tar: TARGET_PLATFORM := linux/amd64 -airgap-image-bundle-linux-arm64.tar: TARGET_PLATFORM := linux/arm64 -airgap-image-bundle-linux-arm.tar: TARGET_PLATFORM := linux/arm/v7 -airgap-image-bundle-linux-riscv64.tar: TARGET_PLATFORM := linux/riscv64 airgap-image-bundle-linux-amd64.tar \ airgap-image-bundle-linux-arm64.tar \ airgap-image-bundle-linux-arm.tar \ -airgap-image-bundle-linux-riscv64.tar: k0s airgap-images.txt - set -- $$(cat airgap-images.txt) && \ +airgap-image-bundle-linux-riscv64.tar \ +airgap-image-bundle-windows2022-amd64.tar: k0s + set -- $$(cat -- '$(@:airgap-image-bundle-%.tar=airgap-images-%.txt)') && \ $(GO_ENV) ./k0s airgap bundle-artifacts --concurrency=1 -v --platform='$(TARGET_PLATFORM)' -o '$@' "$$@" + chmod a+r -- '$@' -ipv6-test-images.txt: $(GO_ENV_REQUISITES) embedded-bins/Makefile.variables hack/gen-test-images-list/main.go +ipv6-test-images-linux-amd64.txt ipv6-test-image-bundle-linux-amd64.tar: TARGET_PLATFORM := linux/amd64 +ipv6-test-images-linux-arm64.txt ipv6-test-image-bundle-linux-arm64.tar: TARGET_PLATFORM := linux/arm64 + +ipv6-test-images-linux-amd64.txt \ +ipv6-test-images-linux-arm64.txt: $(GO_ENV_REQUISITES) embedded-bins/Makefile.variables hack/gen-test-images-list/main.go { \ echo "docker.io/library/nginx:1.30.0-alpine"; \ echo "docker.io/curlimages/curl:8.19.0"; \ @@ -323,24 +341,26 @@ ipv6-test-images.txt: $(GO_ENV_REQUISITES) embedded-bins/Makefile.variables hack $(GO) run -tags=hack ./hack/gen-test-images-list; \ } >'$@' -ipv6-test-image-bundle-linux-amd64.tar: TARGET_PLATFORM := linux/amd64 -ipv6-test-image-bundle-linux-arm64.tar: TARGET_PLATFORM := linux/arm64 -ipv6-test-image-bundle-linux-arm.tar: TARGET_PLATFORM := linux/arm/v7 -ipv6-test-image-bundle-linux-riscv64.tar: TARGET_PLATFORM := linux/riscv64 +ipv6-test-image-bundle-linux-amd64.tar: ipv6-test-images-linux-amd64.txt +ipv6-test-image-bundle-linux-arm64.tar: ipv6-test-images-linux-arm64.txt + ipv6-test-image-bundle-linux-amd64.tar \ -ipv6-test-image-bundle-linux-arm64.tar \ -ipv6-test-image-bundle-linux-arm.tar \ -ipv6-test-image-bundle-linux-riscv64.tar: k0s ipv6-test-images.txt - set -- $$(cat ipv6-test-images.txt) && \ +ipv6-test-image-bundle-linux-arm64.tar: k0s + set -- $$(cat -- '$(@:ipv6-test-image-bundle-%.tar=ipv6-test-images-%.txt)') && \ $(GO_ENV) ./k0s airgap bundle-artifacts -v --platform='$(TARGET_PLATFORM)' -o '$@' "$$@" .PHONY: $(smoketests) $(air_gapped_smoketests) $(ipv6_smoketests): airgap-image-bundle-linux-$(HOST_ARCH).tar + +ifneq ($(filter amd64 arm64,$(HOST_ARCH)),) $(ipv6_smoketests): ipv6-test-image-bundle-linux-$(HOST_ARCH).tar +IPV6_TEST_IMAGE_BUNDLE := $(CURDIR)/ipv6-test-image-bundle-linux-$(HOST_ARCH).tar +endif + $(smoketests): k0s $(MAKE) -C inttest \ K0S_IMAGES_BUNDLE='$(CURDIR)/airgap-image-bundle-linux-$(HOST_ARCH).tar' \ - K0S_EXTRA_IMAGES_BUNDLE='$(CURDIR)/ipv6-test-image-bundle-linux-$(HOST_ARCH).tar' \ + K0S_EXTRA_IMAGES_BUNDLE='$(IPV6_TEST_IMAGE_BUNDLE)' \ $@ .PHONY: smoketests @@ -366,13 +386,15 @@ clean-docker-image: IID_FILES = .k0sbuild.docker-image.k0s clean-docker-image: $(clean-iid-files) -.PHONY: clean-airgap-image-bundles -clean-airgap-image-bundles: - -rm airgap-images.txt - -rm airgap-image-bundle-linux-amd64.tar airgap-image-bundle-linux-arm64.tar airgap-image-bundle-linux-arm.tar airgap-image-bundle-linux-riscv64.tar +.PHONY: clean-image-bundles +clean-image-bundles: + for plat in linux-amd64 linux-arm64 linux-arm linux-riscv64 windows2022-amd64; do \ + rm -f airgap-images-$$plat.txt airgap-image-bundle-$$plat.tar; \ + rm -f ipv6-test-images-$$plat.txt ipv6-test-image-bundle-$$plat.tar; \ + done .PHONY: clean -clean: clean-gocache clean-docker-image clean-airgap-image-bundles +clean: clean-gocache clean-docker-image clean-image-bundles -rm -f k0s k0s.exe k0s.bare k0s.bare.exe .bins.*stamp -rm -f embedded-binaries-linux.zip embedded-binaries-windows.zip -rm -rf $(K0S_GO_BUILD_CACHE)