diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3842d5636c6..2ab2a96590d 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 @@ -58,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: @@ -81,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/.github/workflows/build_and_test_x86.yaml b/.github/workflows/build_and_test_x86.yaml index dc10123ccb9..2f7b540ca30 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' }} @@ -89,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: @@ -115,6 +118,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..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) \ @@ -79,8 +79,12 @@ 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 +build-iso: @echo Building $(ARCH) ISO mkdir -p $(ROOT_DIR)/build $(DOCKER) run --rm -v $(DOCKER_SOCK):$(DOCKER_SOCK) -v $(ROOT_DIR)/build:/build \ @@ -88,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 \ @@ -99,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 @@ -112,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 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