Skip to content

Commit

Permalink
🐧 Split alpine images into dedicated channels (kairos-io#457)
Browse files Browse the repository at this point in the history
Depending on the kernel being used, we build now 2 distinct images
(alpine-opensuse-leap and alpine-ubuntu).

Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>

Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
  • Loading branch information
mudler authored Nov 19, 2022
1 parent da9c5ab commit 57d914b
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 19 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
- flavor: "ubuntu"
- flavor: "ubuntu-20-lts"
- flavor: "ubuntu-22-lts"
- flavor: "alpine"
- flavor: "alpine-ubuntu"
- flavor: "alpine-opensuse-leap"
- flavor: "fedora"
- flavor: "rockylinux"
steps:
Expand Down Expand Up @@ -156,7 +157,7 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: "alpine"
- flavor: "alpine-opensuse-leap"
- flavor: "opensuse"
- flavor: "ubuntu"
- flavor: "ubuntu-20-lts"
Expand Down Expand Up @@ -206,7 +207,7 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: "alpine"
- flavor: "alpine-opensuse-leap"
- flavor: "opensuse"
# - flavor: "ubuntu"
steps:
Expand All @@ -231,7 +232,7 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: "alpine"
- flavor: "alpine-opensuse-leap"
- flavor: "opensuse"
# - flavor: "ubuntu"
steps:
Expand Down Expand Up @@ -294,7 +295,7 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: "alpine"
- flavor: "alpine-opensuse-leap"
- flavor: "opensuse"
# - flavor: "ubuntu"
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ jobs:
matrix:
include:
- flavor: "opensuse"
- flavor: "alpine"
- flavor: "alpine-ubuntu"
- flavor: "alpine-opensuse-leap"
- flavor: "ubuntu-20-lts"
- flavor: "ubuntu-22-lts"
- flavor: "ubuntu"
Expand Down
15 changes: 8 additions & 7 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ framework:
dracut/sysext dracut/systemd-resolved
END

IF [ "$FLAVOR" = "alpine" ] || [ "$FLAVOR" = "alpine-arm-rpi" ]
IF [[ "$FLAVOR" =~ "alpine" ]]
RUN luet install -y --system-target /framework \
init-svc/openrc
ELSE
Expand All @@ -180,10 +180,10 @@ framework:
END

# Keep openSUSE kernel on ARM
IF [ "$FLAVOR" = "opensuse-arm-rpi" ] || [ "$FLAVOR" = "alpine-arm-rpi" ]
IF [ "$FLAVOR" = "opensuse-arm-rpi" ] || [ "$FLAVOR" = "alpine-arm-rpi" ] || [ "$FLAVOR" = "alpine-opensuse-leap" ]
RUN luet install -y --system-target /framework \
distro-kernels/opensuse-leap distro-initrd/opensuse-leap
ELSE IF [ "$WITH_KERNEL" = "true" ] || [ "$FLAVOR" = "alpine" ]
ELSE IF [ "$WITH_KERNEL" = "true" ] || [ "$FLAVOR" = "alpine-ubuntu" ]
RUN luet install -y --system-target /framework \
distro-kernels/ubuntu distro-initrd/ubuntu
END
Expand Down Expand Up @@ -238,10 +238,11 @@ docker:
RUN rm -rf /etc/machine-id && touch /etc/machine-id && chmod 444 /etc/machine-id

# Copy flavor-specific overlay files
IF [ "$FLAVOR" = "alpine" ]
COPY overlay/files-alpine/ /
ELSE IF [ "$FLAVOR" = "alpine-arm-rpi" ]
IF [[ "$FLAVOR" =~ "alpine" ]]
COPY overlay/files-alpine/ /
END

IF [ "$FLAVOR" = "alpine-arm-rpi" ]
COPY overlay/files-opensuse-arm-rpi/ /
ELSE IF [ "$FLAVOR" = "opensuse-arm-rpi" ]
COPY overlay/files-opensuse-arm-rpi/ /
Expand Down Expand Up @@ -432,7 +433,7 @@ linux-bench-scan:
###
### Test targets
###
# usage e.g. ./earthly.sh +run-qemu-datasource-tests --FLAVOR=alpine --FROM_ARTIFACTS=true
# usage e.g. ./earthly.sh +run-qemu-datasource-tests --FLAVOR=alpine-opensuse-leap --FROM_ARTIFACTS=true
run-qemu-datasource-tests:
FROM opensuse/leap
WORKDIR /test
Expand Down
3 changes: 2 additions & 1 deletion docs/content/en/docs/Reference/image_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ The installable mediums part of the releases are generated with the methods desc
| **Ubuntu based (rolling)** ** | https://quay.io/repository/kairos/core-ubuntu | https://quay.io/repository/kairos/kairos-ubuntu |
| **Ubuntu based (22 LTS)** ** | https://quay.io/repository/kairos/core-ubuntu-22-lts | https://quay.io/repository/kairos/kairos-ubuntu-22-lts |
| **Ubuntu based (20 LTS)** ** | https://quay.io/repository/kairos/core-ubuntu-20-lts | https://quay.io/repository/kairos/kairos-ubuntu-20-lts |
| **Alpine Linux based** | https://quay.io/repository/kairos/core-alpine | https://quay.io/repository/kairos/kairos-alpine |
| **Alpine Linux based (openSUSE kernel)** | https://quay.io/repository/kairos/core-alpine-opensuse-leap | https://quay.io/repository/kairos/kairos-alpine-opensuse-leap |
| **Alpine Linux based (Ubuntu kernel)** | https://quay.io/repository/kairos/core-alpine-ubuntu | https://quay.io/repository/kairos/kairos-alpine-ubuntu |
| **openSUSE based (RaspberryPi 3 and 4, arm64)** | https://quay.io/repository/kairos/core-opensuse-arm-rpi | https://quay.io/repository/kairos/kairos-opensuse-arm-rpi |
| **Alpine Linux based (RaspberryPi 3 and 4, arm64)** | https://quay.io/repository/kairos/core-alpine-arm-rpi | https://quay.io/repository/kairos/kairos-alpine-arm-rpi |

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions images/Dockerfile.alpine-ubuntu
3 changes: 2 additions & 1 deletion tests/autoinstall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -35,7 +36,7 @@ var _ = Describe("kairos autoinstall test", Label("autoinstall-test"), func() {

Context("live cd", func() {
It("has default service active", func() {
if os.Getenv("FLAVOR") == "alpine" {
if strings.Contains(os.Getenv("FLAVOR"), "alpine") {
out, _ := Sudo("rc-status")
Expect(out).Should(ContainSubstring("kairos"))
Expect(out).Should(ContainSubstring("kairos-agent"))
Expand Down
2 changes: 1 addition & 1 deletion tests/bundles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var _ = Describe("kairos bundles test", Label("bundles-test"), func() {

Context("live cd", func() {
It("has default service active", func() {
if os.Getenv("FLAVOR") == "alpine" {
if isFlavor("alpine") {
out, _ := Sudo("rc-status")
Expect(out).Should(ContainSubstring("kairos"))
Expect(out).Should(ContainSubstring("kairos-agent"))
Expand Down
2 changes: 1 addition & 1 deletion tests/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var _ = Describe("kairos reset test", Label("reset-test"), func() {

Context("live cd", func() {
It("has default service active", func() {
if os.Getenv("FLAVOR") == "alpine" {
if isFlavor("alpine") {
out, _ := Machine.Command("sudo rc-status")
Expect(out).Should(ContainSubstring("kairos"))
Expect(out).Should(ContainSubstring("kairos-agent"))
Expand Down
5 changes: 5 additions & 0 deletions tests/tests_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"testing"

process "github.com/mudler/go-processmanager"
Expand Down Expand Up @@ -149,3 +150,7 @@ func gatherLogs() {
"/run/cmdline",
})
}

func isFlavor(flavor string) bool {
return strings.Contains(os.Getenv("FLAVOR"), flavor)
}
2 changes: 1 addition & 1 deletion tests/upgrade_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var _ = Describe("k3s upgrade manual test", Label("upgrade-with-cli"), func() {
Fail("CONTAINER_IMAGE needs to be set")
}

if os.Getenv("FLAVOR") == "alpine" {
if isFlavor("alpine") {
out, _ := Sudo("rc-status")
Expect(out).Should(ContainSubstring("kairos"))
Expect(out).Should(ContainSubstring("kairos-agent"))
Expand Down
2 changes: 1 addition & 1 deletion tests/upgrade_latest_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var _ = Describe("k3s upgrade manual test", Label("upgrade-latest-with-cli"), fu
Fail("CONTAINER_IMAGE needs to be set")
}

if os.Getenv("FLAVOR") == "alpine" {
if isFlavor("alpine") {
out, _ := Sudo("rc-status")
Expect(out).Should(ContainSubstring("kairos"))
Expect(out).Should(ContainSubstring("kairos-agent"))
Expand Down

0 comments on commit 57d914b

Please sign in to comment.