Skip to content

Commit

Permalink
Replace image-bundler with k0s airgap bundle-artifacts
Browse files Browse the repository at this point in the history
Dog-food the new sub-command in the k0s build itself.

Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Dec 13, 2024
1 parent c6b08f2 commit 18a9c2e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 56 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build-airgap-image-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
with:
persist-credentials: false

- name: "Download :: k0s"
uses: actions/download-artifact@v4
with:
name: k0s-linux-amd64

- name: "Download :: Airgap image list"
uses: actions/download-artifact@v4
with:
Expand All @@ -44,7 +49,7 @@ jobs:
- name: "Cache :: Airgap image bundle :: Calculate cache key"
id: cache-airgap-image-bundle-calc-key
env:
HASH_VALUE: ${{ hashFiles('Makefile', 'airgap-images.txt', 'hack/image-bundler/*') }}
HASH_VALUE: ${{ hashFiles('Makefile', 'airgap-images.txt', 'cmd/airgap/*', 'pkg/airgap/*') }}
run: |
printf 'cache-key=build-airgap-image-bundle-%s-%s-%s\n' "$TARGET_OS" "$TARGET_ARCH" "$HASH_VALUE" >> "$GITHUB_OUTPUT"
Expand All @@ -58,6 +63,7 @@ jobs:
- name: "Build :: Airgap image bundle"
if: steps.cache-airgap-image-bundle.outputs.cache-hit != 'true'
run: |
chmod +x k0s
mkdir -p "embedded-bins/staging/$TARGET_OS/bin"
make --touch airgap-images.txt
make "airgap-image-bundle-$TARGET_OS-$TARGET_ARCH.tar"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ jobs:
id: cache-airgap-image-bundle
uses: actions/cache@v4
with:
key: airgap-image-bundle-linux-${{ matrix.arch }}-${{ hashFiles('Makefile', 'airgap-images.txt', 'hack/image-bundler/*') }}
key: airgap-image-bundle-linux-${{ matrix.arch }}-${{ hashFiles('Makefile', 'airgap-images.txt', 'cmd/airgap/*', 'pkg/airgap/*') }}
path: |
airgap-images.txt
airgap-image-bundle-linux-${{ matrix.arch }}.tar
Expand Down
13 changes: 2 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,8 @@ 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-amd64.tar \
airgap-image-bundle-linux-arm64.tar \
airgap-image-bundle-linux-arm.tar: .k0sbuild.image-bundler.stamp airgap-images.txt
docker run --rm -i --privileged \
-e TARGET_PLATFORM='$(TARGET_PLATFORM)' \
'$(shell cat .k0sbuild.image-bundler.stamp)' < airgap-images.txt > '$@'

.k0sbuild.image-bundler.stamp: hack/image-bundler/* embedded-bins/Makefile.variables
docker build --progress=plain --iidfile '$@' \
--build-arg ALPINE_VERSION=$(alpine_patch_version) \
-t k0sbuild.image-bundler -- hack/image-bundler
airgap-image-bundle-linux-arm.tar: k0s airgap-images.txt
./k0s airgap -v bundle-images --platform='$(TARGET_PLATFORM)' -o '$@' <airgap-images.txt

.PHONY: $(smoketests)
check-airgap check-ap-airgap: airgap-image-bundle-linux-$(HOST_ARCH).tar
Expand Down Expand Up @@ -269,9 +262,7 @@ clean-docker-image:
$(clean-iid-files)

.PHONY: clean-airgap-image-bundles
clean-airgap-image-bundles: IID_FILES = .k0sbuild.image-bundler.stamp
clean-airgap-image-bundles:
$(clean-iid-files)
-rm airgap-images.txt
-rm airgap-image-bundle-linux-amd64.tar airgap-image-bundle-linux-arm64.tar airgap-image-bundle-linux-arm.tar

Expand Down
1 change: 1 addition & 0 deletions cmd/airgap/testdata/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oci-layout/blobs/** binary
6 changes: 0 additions & 6 deletions hack/image-bundler/Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions hack/image-bundler/bundler.sh

This file was deleted.

0 comments on commit 18a9c2e

Please sign in to comment.