From 90d274d9c5bd9f5e648ba657468fe2dc71d67009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 14:13:24 +0100 Subject: [PATCH 1/7] build-toolkit depends on detect job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3842d5636c6..095985defca 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,6 +42,8 @@ jobs: fi build-toolkit: + needs: + - detect permissions: packages: write runs-on: ubuntu-latest From 6dfe76dd2cd4889242e978d5ebef7860481e5a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 14:16:37 +0100 Subject: [PATCH 2/7] Test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 095985defca..8e2431f641e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ on: push: tags: - v** - pull_request_target: + pull_request: types: - opened - synchronize From 4e4487640e389783de9f90e4093a02a7bab93509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 14:22:05 +0100 Subject: [PATCH 3/7] Set version on GITHUB_OUTPUT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8e2431f641e..84a056dd811 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -60,7 +60,7 @@ jobs: git fetch --prune --unshallow - id: set-version run: | - git describe --tags --candidates=50 >> $GITHUB_OUTPUT + echo "version="$(git describe --tags --candidates=50) >> $GITHUB_OUTPUT - name: Log in to ghcr.io uses: docker/login-action@v3 with: From ec75eb127de2337faf7f1f2f8b5395f13805fe42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 14:41:07 +0100 Subject: [PATCH 4/7] Pull OS and toolkit in actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- .github/workflows/build_and_test_x86.yaml | 4 +++- Makefile | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test_x86.yaml b/.github/workflows/build_and_test_x86.yaml index dc10123ccb9..023760294c0 100644 --- a/.github/workflows/build_and_test_x86.yaml +++ b/.github/workflows/build_and_test_x86.yaml @@ -35,7 +35,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build toolkit + - name: Build OS run: | make pull-toolkit make ARCH=${{ env.ARCH }} DOCKER_ARGS=--load build-os @@ -69,6 +69,7 @@ jobs: - if: ${{ steps.cache-iso.outputs.cache-hit != 'true' }} name: Build ISO run: | + make pull-toolkit pull-os make build-iso sudo mv build/elemental-${{ env.FLAVOR }}.${{ env.ARCH}}.iso /tmp/ - if: ${{ steps.cache-iso.outputs.cache-hit != 'true' }} @@ -115,6 +116,7 @@ jobs: name: Install to disk run: | sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-utils coreutils + make pull-toolkit pull-os sudo -E make ARCH=${{ env.ARCH }} build-disk sudo mv build/elemental-${{ env.FLAVOR }}.${{ env.ARCH}}.qcow2 /tmp/ - if: ${{ steps.cache-check.outputs.cache-hit != 'true' }} diff --git a/Makefile b/Makefile index 6a3030c4c64..3a0e8b78aef 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,10 @@ build-os: build push-os: $(DOCKER) push $(REPO):$(VERSION) +.PHONY: pull-os +pull-os: + $(DOCKER) pull $(REPO):$(VERSION) + .PHONY: build-iso build-iso: build-os @echo Building $(ARCH) ISO From 27f1a85680074d38e461db96f3759061cc32458a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 14:42:07 +0100 Subject: [PATCH 5/7] Remove phony recipe dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3a0e8b78aef..f4c053a4905 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ build-cli: go build -ldflags '$(LDFLAGS)' -o build/elemental .PHONY: build-os -build-os: build +build-os: $(DOCKER) build --platform $(PLATFORM) ${DOCKER_ARGS} \ --build-arg TOOLKIT_REPO=$(TOOLKIT_REPO) \ --build-arg VERSION=$(VERSION) \ @@ -84,7 +84,7 @@ pull-os: $(DOCKER) pull $(REPO):$(VERSION) .PHONY: build-iso -build-iso: build-os +build-iso: @echo Building $(ARCH) ISO mkdir -p $(ROOT_DIR)/build $(DOCKER) run --rm -v $(DOCKER_SOCK):$(DOCKER_SOCK) -v $(ROOT_DIR)/build:/build \ @@ -92,7 +92,7 @@ build-iso: build-os --local --platform $(PLATFORM) --squash-no-compression -o /build $(REPO):$(VERSION) .PHONY: build-disk -build-disk: build-os +build-disk: @echo Building $(ARCH) disk mkdir -p $(ROOT_DIR)/build $(DOCKER) run --rm -v $(DOCKER_SOCK):$(DOCKER_SOCK) -v $(ROOT_DIR)/build:/build \ @@ -103,7 +103,7 @@ build-disk: build-os qemu-img resize $(ROOT_DIR)/build/elemental-$(FLAVOR).$(ARCH).qcow2 $(DISKSIZE) .PHONY: build-rpi-disk -build-rpi-disk: build-os +build-rpi-disk: ifneq ("$(PLATFORM)","linux/arm64") @echo "Cannot build Raspberry Pi disk for $(PLATFORM)" @exit 1 @@ -116,7 +116,7 @@ endif --squash-no-compression --deploy-command elemental,--debug,reset,--reboot,--disable-boot-entry -o /build $(REPO):$(VERSION) PHONY: build-vf2-disk -build-vf2-disk: build-os +build-vf2-disk: ifneq ("$(PLATFORM)","linux/riscv64") @echo "Cannot build VisionFive2 disk for $(PLATFORM)" @exit 1 From 43ac17b492774fc56c4f27125b3999fafbe4a977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 15:11:18 +0100 Subject: [PATCH 6/7] Add REPO and TOOLKIT_REPO to action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- .github/workflows/build_and_test_x86.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_and_test_x86.yaml b/.github/workflows/build_and_test_x86.yaml index 023760294c0..2f7b540ca30 100644 --- a/.github/workflows/build_and_test_x86.yaml +++ b/.github/workflows/build_and_test_x86.yaml @@ -90,6 +90,8 @@ jobs: env: FLAVOR: ${{ inputs.flavor }} ARCH: x86_64 + TOOLKIT_REPO: ghcr.io/${{github.repository}}/elemental-cli + REPO: ghcr.io/${{ github.repository }}/elemental-${{ inputs.flavor }} steps: - uses: actions/checkout@v4 with: From 3c3d71960bff0a635378812e4e27571e7d6b4408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Tue, 13 Feb 2024 15:37:14 +0100 Subject: [PATCH 7/7] Squash me MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Lönnegren --- .github/workflows/build.yaml | 33 ++++++++++++++------------- tests/installer/installer_efi_test.go | 5 ++-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 84a056dd811..2ab2a96590d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ on: push: tags: - v** - pull_request: + pull_request_target: types: - opened - synchronize @@ -83,18 +83,19 @@ jobs: with: flavor: ${{ matrix.flavor }} - cleanup: - runs-on: ubuntu-latest - permissions: - packages: write - needs: - - build-toolkit - - build-matrix - steps: - - uses: actions/delete-package-versions@v4 - if: ${{ !startsWith(github.event.ref, 'refs/tags/v') }} - with: - package-version-ids: ${{ needs.build-toolkit.outputs.version }} - owner: ${{ github.owner }} - package-name: elemental-toolkit/elemental-cli - package-type: container + # TODO: use integer package-version-id instead of tag. + # cleanup: + # runs-on: ubuntu-latest + # permissions: + # packages: write + # needs: + # - build-toolkit + # - build-matrix + # steps: + # - uses: actions/delete-package-versions@v4 + # if: ${{ !startsWith(github.event.ref, 'refs/tags/v') }} + # with: + # package-version-ids: ${{ needs.build-toolkit.outputs.version }} + # owner: ${{ github.owner }} + # package-name: elemental-toolkit/elemental-cli + # package-type: container diff --git a/tests/installer/installer_efi_test.go b/tests/installer/installer_efi_test.go index 9e8c912da4d..2f68d67df35 100644 --- a/tests/installer/installer_efi_test.go +++ b/tests/installer/installer_efi_test.go @@ -5,6 +5,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + sut "github.com/rancher/elemental-toolkit/tests/vm" ) @@ -43,9 +44,9 @@ var _ = Describe("Elemental Installer EFI tests", func() { Expect(out).To(ContainSubstring("Partitioning device...")) Expect(out).To(ContainSubstring("Running after-install hook")) - // Reboot so we boot into the just installed cos + // Reboot so we boot into the just installed system s.Reboot() - By("Checking we booted from the installed cOS") + By("Checking we booted from the installed system") ExpectWithOffset(1, s.BootFrom()).To(Equal(sut.Active)) // check partition values // Values have to match the yaml under ../assets/layout.yaml