diff --git a/.github/workflows/uki_branches.yaml b/.github/workflows/uki_branches.yaml new file mode 100644 index 000000000..cca626f8e --- /dev/null +++ b/.github/workflows/uki_branches.yaml @@ -0,0 +1,171 @@ +name: Manual UKI tests against specific branches +on: + workflow_dispatch: + inputs: + immucore_branch: + description: 'Immucore branch to build against' + required: false + type: string + default: "main" + agent_branch: + description: 'Kairos-agent branch to build against' + required: false + type: string + default: "main" + +concurrency: + group: ci-uki-branches-${{ github.head_ref || github.ref }}-${{ github.repository }} + cancel-in-progress: true +env: + FORCE_COLOR: 1 +jobs: + test-uki-ubuntu: + runs-on: kvm + env: + FLAVOR: ubuntu + FLAVOR_RELEASE: 23.10 + steps: + - uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: tests/go.mod + cache-dependency-path: tests/go.sum + cache: false + - name: Enable KVM group perms + run: | + sudo apt-get update + sudo apt-get install -y libvirt-clients libvirt-daemon-system libvirt-daemon virtinst bridge-utils qemu qemu-system-x86 qemu-system-x86 qemu-utils qemu-kvm acl udev + # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ + # echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + # sudo udevadm control --reload-rules + # sudo udevadm trigger --name-match=kvm + # sudo usermod -a -G kvm,libvirt $USER + # + # TODO: Switch back to the above solution when we switch to the github runners + # https://askubuntu.com/a/1081326 + sudo setfacl -m u:runner:rwx /dev/kvm + - name: Install earthly + uses: Luet-lab/luet-install-action@v1.1 + with: + repository: quay.io/kairos/packages + packages: utils/earthly + - name: Build base image 🔧 + run: | # known flavors to work with uki+encryption: fedora >= 38, ubuntu >= 23.10, anything with systemd 253 + earthly +base-image \ + --FLAVOR=ubuntu \ + --FLAVOR_RELEASE=23.10 \ + --FAMILY=ubuntu \ + --MODEL=generic \ + --VARIANT=core \ + --BASE_IMAGE=ubuntu:23.10 \ + --IMMUCORE_DEV_BRANCH=${{ github.event.inputs.immucore_branch }} \ + --KAIROS_AGENT_DEV_BRANCH=${{ github.event.inputs.agent_branch }} + - name: Push image to ttl.sh + env: + TEMP_IMAGE: ttl.sh/ubuntu-2310-${{ github.sha }}:24h + run: | + docker tag $(cat build/IMAGE) $TEMP_IMAGE + docker push $TEMP_IMAGE + - name: Build uki ISO 🔧 + run: | + earthly +uki-iso --BASE_IMAGE=ttl.sh/ubuntu-2310-${{ github.sha }}:24h + - name: Create datasource iso 🔧 + run: | + earthly +datasource-iso --CLOUD_CONFIG=tests/assets/autoinstall.yaml + - name: Run tests 🔧 + env: + USE_QEMU: true + KVM: true + MEMORY: 4000 + CPUS: 2 + FIRMWARE: /usr/share/OVMF/OVMF_CODE.fd + EMULATE_TPM: true + UKI_TEST: true + run: | + export ISO=$(ls $PWD/build/kairos_*.iso) + export DATASOURCE=${PWD}/build/datasource.iso + cp tests/go.* . + go run github.com/onsi/ginkgo/v2/ginkgo -v --label-filter "uki" --fail-fast -r ./tests/ + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: ${{ env.FLAVOR }}-${{ env.FLAVOR_RELEASE }}.logs.zip + path: tests/**/logs/* + if-no-files-found: warn + test-uki-fedora: + runs-on: kvm + env: + FLAVOR: fedora + FLAVOR_RELEASE: 38 + steps: + - uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: tests/go.mod + cache-dependency-path: tests/go.sum + cache: false + - name: Enable KVM group perms + run: | + sudo apt-get update + sudo apt-get install -y libvirt-clients libvirt-daemon-system libvirt-daemon virtinst bridge-utils qemu qemu-system-x86 qemu-system-x86 qemu-utils qemu-kvm acl udev + # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ + # echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + # sudo udevadm control --reload-rules + # sudo udevadm trigger --name-match=kvm + # sudo usermod -a -G kvm,libvirt $USER + # + # TODO: Switch back to the above solution when we switch to the github runners + # https://askubuntu.com/a/1081326 + sudo setfacl -m u:runner:rwx /dev/kvm + - name: Install earthly + uses: Luet-lab/luet-install-action@v1.1 + with: + repository: quay.io/kairos/packages + packages: utils/earthly + - name: Build base image 🔧 + run: | # known flavors to work with uki+encryption: fedora >= 38, ubuntu >= 23.10, anything with systemd 253 + earthly +base-image \ + --FLAVOR=fedora \ + --FLAVOR_RELEASE=38 \ + --FAMILY=rhel \ + --MODEL=generic \ + --VARIANT=core \ + --BASE_IMAGE=fedora:38 \ + --IMMUCORE_DEV_BRANCH=${{ github.event.inputs.immucore_branch }} \ + --KAIROS_AGENT_DEV_BRANCH=${{ github.event.inputs.agent_branch }} + - name: Push image to ttl.sh + env: + TEMP_IMAGE: ttl.sh/fedora-38-${{ github.sha }}:24h + run: | + docker tag $(cat build/IMAGE) $TEMP_IMAGE + docker push $TEMP_IMAGE + - name: Build uki ISO 🔧 + run: | + earthly +uki-iso \ + --BASE_IMAGE=ttl.sh/fedora-38-${{ github.sha }}:24h + - name: Create datasource iso 🔧 + run: | + earthly +datasource-iso --CLOUD_CONFIG=tests/assets/autoinstall.yaml + - name: Run tests 🔧 + env: + USE_QEMU: true + KVM: true + MEMORY: 4000 + CPUS: 2 + FIRMWARE: /usr/share/OVMF/OVMF_CODE.fd + EMULATE_TPM: true + UKI_TEST: true + run: | + export ISO=$(ls $PWD/build/kairos_*.iso) + export DATASOURCE=${PWD}/build/datasource.iso + cp tests/go.* . + go run github.com/onsi/ginkgo/v2/ginkgo -v --label-filter "uki" --fail-fast -r ./tests/ + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: ${{ env.FLAVOR }}-${{ env.FLAVOR_RELEASE }}.logs.zip + path: tests/**/logs/* + if-no-files-found: warm +