Skip to content

Commit

Permalink
Add pure alpine flavor
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
  • Loading branch information
Itxaka committed Oct 9, 2023
1 parent 7eeeb55 commit a34209d
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/flavors.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"standard": "true"
},
{
"flavor": "alpine-ubuntu",
"flavor": "alpine",
"standard": "true"
},
{
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/image-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: "alpine-opensuse-leap"
- flavor: "alpine"
- flavor: "opensuse-leap"
- flavor: "opensuse-tumbleweed"
- flavor: "ubuntu"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -170,7 +171,7 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: alpine-opensuse-leap
- flavor: alpine
- flavor: opensuse-leap
# - flavor: "ubuntu"
# - flavor: "ubuntu"
Expand Down Expand Up @@ -353,4 +354,4 @@ jobs:
]
}
]
}
}
16 changes: 0 additions & 16 deletions .github/workflows/lint.yml

This file was deleted.

15 changes: 15 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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" ]
Expand Down
19 changes: 10 additions & 9 deletions framework-profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion images/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -106,13 +111,16 @@ 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 && \
rc-update add hwclock 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
Expand Down
15 changes: 12 additions & 3 deletions tests/autoinstall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down
10 changes: 10 additions & 0 deletions tests/netboot_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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())
})

Expand Down

0 comments on commit a34209d

Please sign in to comment.