Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolkit needs #1956

Merged
merged 7 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
fi

build-toolkit:
needs:
- detect
permissions:
packages: write
runs-on: ubuntu-latest
Expand All @@ -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:
Expand All @@ -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
6 changes: 5 additions & 1 deletion .github/workflows/build_and_test_x86.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' }}
Expand All @@ -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:
Expand All @@ -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' }}
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -79,16 +79,20 @@ 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 \
--entrypoint /usr/bin/elemental $(TOOLKIT_REPO):$(VERSION) --debug build-iso --bootloader-in-rootfs -n elemental-$(FLAVOR).$(ARCH) \
--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 \
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tests/installer/installer_efi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

sut "github.com/rancher/elemental-toolkit/tests/vm"
)

Expand Down Expand Up @@ -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
Expand Down
Loading