diff --git a/.github/flavors.json b/.github/flavors.json index f13237b3b0..10dbb1c9bf 100644 --- a/.github/flavors.json +++ b/.github/flavors.json @@ -24,7 +24,7 @@ "standard": "true" }, { - "flavor": "alpine-ubuntu", + "flavor": "alpine", "standard": "true" }, { diff --git a/.github/workflows/image-pr.yaml b/.github/workflows/image-pr.yaml index 150d879127..c40a2ac03f 100644 --- a/.github/workflows/image-pr.yaml +++ b/.github/workflows/image-pr.yaml @@ -13,12 +13,12 @@ jobs: core: uses: ./.github/workflows/reusable-build-flavor.yaml with: - flavor: ubuntu + flavor: alpine install: uses: ./.github/workflows/reusable-install-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core @@ -32,49 +32,49 @@ jobs: acceptance: uses: ./.github/workflows/reusable-qemu-acceptance-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core bundles: uses: ./.github/workflows/reusable-qemu-bundles-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core reset: uses: ./.github/workflows/reusable-qemu-reset-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core netboot: uses: ./.github/workflows/reusable-qemu-netboot-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core upgrade: uses: ./.github/workflows/reusable-upgrade-with-cli-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core upgrade-latest: uses: ./.github/workflows/reusable-upgrade-latest-test.yaml with: - flavor: ubuntu + flavor: alpine needs: - core encryption: uses: ./.github/workflows/reusable-encryption-test.yaml with: - flavor: ubuntu + flavor: alpine label: ${{ matrix.label }} needs: - core diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index c1c6d7aaea..9b71a710a1 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -105,7 +105,7 @@ jobs: fail-fast: false matrix: include: - - flavor: "alpine-opensuse-leap" + - flavor: "alpine" - flavor: "opensuse-leap" - flavor: "opensuse-tumbleweed" - flavor: "ubuntu" @@ -133,7 +133,7 @@ jobs: fail-fast: false matrix: include: - - flavor: alpine-opensuse-leap + - flavor: alpine - flavor: opensuse-leap netboot: uses: ./.github/workflows/reusable-qemu-netboot-test.yaml @@ -145,20 +145,21 @@ jobs: fail-fast: false matrix: include: - - flavor: alpine-opensuse-leap + - flavor: alpine - flavor: opensuse-leap - flavor: ubuntu upgrade: uses: ./.github/workflows/reusable-upgrade-with-cli-test.yaml with: flavor: ${{ matrix.flavor }} + needs: - core strategy: fail-fast: false matrix: include: - - flavor: alpine-opensuse-leap + - flavor: alpine - flavor: opensuse-leap upgrade-latest: uses: ./.github/workflows/reusable-upgrade-latest-test.yaml @@ -170,7 +171,7 @@ jobs: fail-fast: false matrix: include: - - flavor: alpine-opensuse-leap + - flavor: alpine - flavor: opensuse-leap # - flavor: "ubuntu" # - flavor: "ubuntu" @@ -353,4 +354,4 @@ jobs: ] } ] - } + } \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index da54105110..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Lint -on: - push: - branches: - - master - pull_request: - paths: - - '**' -env: - FORCE_COLOR: 1 -jobs: - call-workflow: - uses: kairos-io/linting-composite-action/.github/workflows/reusable-linting.yaml@v0.0.8 - with: - yamldirs: ".github/workflows/" - is-go: false diff --git a/Earthfile b/Earthfile index 10b346346f..deee06f4bc 100644 --- a/Earthfile +++ b/Earthfile @@ -258,6 +258,7 @@ framework: COPY framework-profile.yaml /build COPY +luet/luet /usr/bin/luet + RUN go mod download RUN go run main.go ${FLAVOR} framework-profile.yaml /framework RUN mkdir -p /framework/etc/kairos/ @@ -451,7 +452,21 @@ base-image: RUN rm -rf /boot/initramfs-* END + # Cleanup for alpine as this gets installed as a side-effect + # we already provide a /boot/initrd with the luet package + IF [ -e "/boot/initramfs-lts" ] + RUN rm /boot/initramfs-lts + END + IF [ ! -e "/boot/vmlinuz" ] + IF [ -e "/boot/vmlinuz-lts" ] + # Alpine provides the kernel under this name + RUN ln -sf /boot/vmlinuz-lts /boot/vmlinuz + END + IF [ -e "/boot/vmlinuz-rpi4" ] + # Alpine-rpi provides the kernel under this name + RUN ln -sf /boot/vmlinuz-rpi4 /boot/vmlinuz + END # If it's an ARM flavor, we want a symlink here from zImage/Image # Check that its not a symlink already or grub will fail! IF [ -e "/boot/Image" ] && [ ! -L "/boot/Image" ] diff --git a/framework-profile.yaml b/framework-profile.yaml index 300d6c23b9..25f3edc848 100755 --- a/framework-profile.yaml +++ b/framework-profile.yaml @@ -96,22 +96,23 @@ flavors: - systemd-base - systemd-latest - dracut-network-legacy - alpine-arm-rpi: - - common-packages - - kairos-toolchain - - opensuse-leap-kernel - - openrc - alpine-opensuse-leap: + alpine: - common-packages - kairos-toolchain - openrc - - opensuse-leap-kernel - alpine-ubuntu: + - alpine-pure + alpine-arm-rpi: - common-packages - kairos-toolchain - - ubuntu-kernel - openrc + - alpine-pure-rpi # See https://github.com/kairos-io/packages/pull/67 for rationale +alpine-pure: + packages: + - distro-kernel/alpine +alpine-pure-rpi: + packages: + - distro-kernel/alpine-rpi dracut-network-legacy: packages: - dracut/network-legacy diff --git a/images/Dockerfile.alpine b/images/Dockerfile.alpine index 6238ced36d..34dcbb3516 100644 --- a/images/Dockerfile.alpine +++ b/images/Dockerfile.alpine @@ -7,13 +7,16 @@ ARG MODEL=generic #### Common #### ############################################################### FROM alpine AS common + RUN apk --no-cache add \ bash \ bash-completion \ blkid \ + cloud-utils-growpart \ + bonding \ + bridge \ busybox-openrc \ ca-certificates \ - cloud-utils-growpart \ connman \ conntrack-tools \ coreutils \ @@ -68,7 +71,9 @@ RUN apk --no-cache add \ open-vm-tools-vmbackup \ parted \ procps \ + parted \ qemu-guest-agent \ + rbd-nbd \ rng-tools \ rsync \ smartmontools \ @@ -106,6 +111,8 @@ FROM rpicommon AS rpi4 #### Post-Process Common to All #### ############################################################### FROM ${MODEL} AS all + + RUN rc-update add sshd boot && \ rc-update add connman boot && \ rc-update add acpid boot && \ @@ -113,6 +120,7 @@ RUN rc-update add sshd boot && \ rc-update add syslog boot && \ rc-update add udev sysinit && \ rc-update add udev-trigger sysinit && \ + rc-update add cgroups sysinit && \ rc-update add ntpd boot && \ rc-update add crond && \ rc-update add fail2ban diff --git a/tests/autoinstall_test.go b/tests/autoinstall_test.go index 64529920ca..bacbda81c4 100644 --- a/tests/autoinstall_test.go +++ b/tests/autoinstall_test.go @@ -5,6 +5,7 @@ import ( "os" "path/filepath" "strings" + "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -37,6 +38,10 @@ var _ = Describe("kairos autoinstall test", Label("autoinstall-test"), func() { AfterEach(func() { if CurrentSpecReport().Failed() { gatherLogs(vm) + serial, _ := os.ReadFile(filepath.Join(vm.StateDir, "serial.log")) + _ = os.MkdirAll("logs", os.ModePerm|os.ModeDir) + _ = os.WriteFile(filepath.Join("logs", "serial.log"), serial, os.ModePerm) + fmt.Println(string(serial)) } err := vm.Destroy(nil) @@ -92,9 +97,13 @@ var _ = Describe("kairos autoinstall test", Label("autoinstall-test"), func() { }) By("checking bpf mount", func() { - out, err := vm.Sudo("mount") - Expect(err).ToNot(HaveOccurred()) - Expect(out).To(ContainSubstring("bpf")) + Eventually(func() string { + out, _ := vm.Sudo("mount") + return out + }, 5*time.Minute, 1*time.Second).Should( + Or( + ContainSubstring("bpf"), + )) }) By("checking correct permissions", func() { diff --git a/tests/netboot_test.go b/tests/netboot_test.go index 148bdea37c..e7aed9cb53 100644 --- a/tests/netboot_test.go +++ b/tests/netboot_test.go @@ -1,7 +1,10 @@ package mos_test import ( + "fmt" . "github.com/spectrocloud/peg/matcher" + "os" + "path/filepath" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -14,6 +17,13 @@ var _ = Describe("kairos netboot test", Label("netboot-test"), func() { }) AfterEach(func() { + if CurrentSpecReport().Failed() { + gatherLogs(vm) + serial, _ := os.ReadFile(filepath.Join(vm.StateDir, "serial.log")) + _ = os.MkdirAll("logs", os.ModePerm|os.ModeDir) + _ = os.WriteFile(filepath.Join("logs", "serial.log"), serial, os.ModePerm) + fmt.Println(string(serial)) + } Expect(vm.Destroy(nil)).ToNot(HaveOccurred()) })