From b84703a0ba67f8f8e8886094f9679d65b3ecc60c Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 7 Mar 2024 10:23:31 -0800 Subject: [PATCH] Build k3s image for docker tests Signed-off-by: Derek Nola --- .github/workflows/build-k3s.yaml | 10 ++++++++++ .github/workflows/e2e.yaml | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-k3s.yaml b/.github/workflows/build-k3s.yaml index 6f262c0230db..10ca581f5434 100644 --- a/.github/workflows/build-k3s.yaml +++ b/.github/workflows/build-k3s.yaml @@ -7,6 +7,10 @@ on: type: boolean required: false default: false + upload-image: + type: boolean + required: false + default: false permissions: contents: read @@ -23,6 +27,9 @@ jobs: run: | DOCKER_BUILDKIT=1 SKIP_IMAGE=1 SKIP_AIRGAP=1 SKIP_VALIDATE=1 GOCOVER=1 make sha256sum dist/artifacts/k3s | sed 's|dist/artifacts/||' > dist/artifacts/k3s.sha256sum + - name: Build K3s image + if: inputs.upload-image == true + run: make package-image - name: bundle repo if: inputs.upload-repo == true run: | @@ -34,6 +41,9 @@ jobs: with: name: k3s-repo.tar.gz path: k3s-repo.tar.gz + - name: "Save K3s image" + if: inputs.upload-image == true + run: docker image save rancher/k3s -o ./dist/artifacts/k3s-image.tar - name: "Upload K3s binary" if: inputs.upload-repo == false uses: actions/upload-artifact@v4 diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 85a1ccc2e64e..e5f2d6b32890 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -26,6 +26,8 @@ permissions: jobs: build: uses: ./.github/workflows/build-k3s.yaml + with: + upload-image: true e2e: name: "E2E Tests" needs: build @@ -98,11 +100,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 1 - - name: "Download k3s binary" + - name: "Download k3s image" uses: actions/download-artifact@v4 with: name: k3s path: ./dist/artifacts + - name: Load k3s image + run: docker image load -i ./dist/artifacts/k3s-image.tar - name: Run ${{ matrix.dtest }} Test run: | chmod +x ./dist/artifacts/k3s