Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
- alpine
- centos
- quay.io/centos/centos:stream
- almalinux
- rockylinux

steps:
- name: Free Disk Space (Ubuntu)
Expand Down Expand Up @@ -112,6 +114,8 @@ jobs:
- debian:13
- centos:8
- quay.io/centos/centos:stream10
- almalinux:10
- rockylinux:9
steps:
- name: Free Disk Space (Ubuntu)
uses: linka-cloud/free-disk-space@main
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Working and tested:
Luks support is available only on Debian buster+
- [x] Alpine
- [x] CentOS (8+)
- [x] Rocky Linux
- [x] AlmaLinux

Unsupported:

Expand Down
2 changes: 1 addition & 1 deletion builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ func (b *builder) cmdline(_ context.Context) string {
switch b.osRelease.ID {
case ReleaseAlpine:
return b.config.Cmdline(RootUUID(b.rootUUID), "root=/dev/mapper/root", "cryptdm=root", "cryptroot=UUID="+b.cryptUUID, b.cmdLineExtra)
case ReleaseCentOS:
case ReleaseCentOS, ReleaseRocky, ReleaseAlmaLinux:
return b.config.Cmdline(RootUUID(b.rootUUID), "rd.luks.name=UUID="+b.rootUUID+" rd.luks.uuid="+b.cryptUUID+" rd.luks.crypttab=0", b.cmdLineExtra)
default:
// for some versions of debian, the cryptopts parameter MUST contain all the following: target,source,key,opts...
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r OSRelease) Config() (Config, error) {
return configDebian, nil
case ReleaseAlpine:
return configAlpine, nil
case ReleaseCentOS:
case ReleaseCentOS, ReleaseRocky, ReleaseAlmaLinux:
return configCentOS, nil
default:
return Config{}, fmt.Errorf("%s: distribution not supported", r.ID)
Expand Down
8 changes: 8 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ func TestConfig(t *testing.T) {
image: "quay.io/centos/centos:stream10",
config: configCentOS,
},
{
image: "almalinux:10",
config: configCentOS,
},
{
image: "rockylinux:9",
config: configCentOS,
},
}
exec.SetDebug(true)

Expand Down
4 changes: 2 additions & 2 deletions dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func NewDockerfile(release OSRelease, img, password string, networkManager Netwo
if networkManager == NetworkManagerNetplan {
return d, fmt.Errorf("netplan is not supported on alpine")
}
case ReleaseCentOS:
case ReleaseCentOS, ReleaseRocky, ReleaseAlmaLinux:
d.tmpl = centOSDockerfileTemplate
net = NetworkManagerNone
if networkManager != "" && networkManager != NetworkManagerNone {
Expand All @@ -112,7 +112,7 @@ func NewDockerfile(release OSRelease, img, password string, networkManager Netwo
return Dockerfile{}, fmt.Errorf("unsupported distribution: %s", release.ID)
}
if d.NetworkManager == "" {
if release.ID != ReleaseCentOS {
if release.ID != ReleaseCentOS && release.ID != ReleaseRocky && release.ID != ReleaseAlmaLinux {
logrus.Warnf("no network manager specified, using distribution defaults: %s", net)
}
d.NetworkManager = net
Expand Down
4 changes: 3 additions & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ var (
{name: "debian:13", luks: "Please unlock disk root:"},
{name: "centos:8", luks: "Please enter passphrase for disk"},
{name: "quay.io/centos/centos:stream10", luks: "Please enter passphrase for disk"},
{name: "almalinux:10", luks: "Please enter passphrase for disk"},
{name: "rockylinux:9", luks: "Please enter passphrase for disk"},
}
imgNames = func() []string {
var imgs []string
Expand Down Expand Up @@ -118,7 +120,7 @@ imgs:

defer os.RemoveAll(dir)
for _, img := range testImgs {
if strings.Contains(img.name, "centos") && tt.efi {
if (strings.Contains(img.name, "centos") || strings.Contains(img.name, "almalinux") || strings.Contains(img.name, "rocky")) && tt.efi {
t.Skip("efi not supported for CentOS")
}
t.Run(img.name, func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions grub.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func (g grubProvider) New(c Config, r OSRelease, arch string) (Bootloader, error
if arch != "x86_64" {
return nil, fmt.Errorf("grub is only supported for amd64")
}
if r.ID == ReleaseCentOS {
return nil, fmt.Errorf("grub (efi) is not supported for CentOS, use grub-bios instead")
if r.ID == ReleaseCentOS || r.ID == ReleaseRocky || r.ID == ReleaseAlmaLinux {
return nil, fmt.Errorf("grub (efi) is not supported for CentOS / Rocky / AlmaLinux, use grub-bios instead")
}
return grub{grubCommon: newGrubCommon(c, r)}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion grub_efi.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type grubEFIProvider struct {
}

func (g grubEFIProvider) New(c Config, r OSRelease, arch string) (Bootloader, error) {
if r.ID == ReleaseCentOS {
if r.ID == ReleaseCentOS || r.ID == ReleaseRocky || r.ID == ReleaseAlmaLinux {
return nil, fmt.Errorf("grub-efi is not supported for CentOS, use grub-bios instead")
}
return grubEFI{grubCommon: newGrubCommon(c, r), arch: arch}, nil
Expand Down
22 changes: 16 additions & 6 deletions os_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ import (
)

const (
ReleaseUbuntu Release = "ubuntu"
ReleaseDebian Release = "debian"
ReleaseAlpine Release = "alpine"
ReleaseCentOS Release = "centos"
ReleaseRHEL Release = "rhel"
ReleaseKali Release = "kali"
ReleaseUbuntu Release = "ubuntu"
ReleaseDebian Release = "debian"
ReleaseAlpine Release = "alpine"
ReleaseCentOS Release = "centos"
ReleaseRHEL Release = "rhel"
ReleaseKali Release = "kali"
ReleaseRocky Release = "rocky"
ReleaseAlmaLinux Release = "almalinux"
)

type Release string
Expand All @@ -48,6 +50,10 @@ func (r Release) Supported() bool {
return true
case ReleaseCentOS:
return true
case ReleaseRocky:
return true
case ReleaseAlmaLinux:
return true
case ReleaseRHEL:
return false
default:
Expand Down Expand Up @@ -79,6 +85,10 @@ func (r OSRelease) SupportsLUKS() bool {
return true
case ReleaseCentOS:
return true
case ReleaseRocky:
return true
case ReleaseAlmaLinux:
return true
case ReleaseAlpine:
return true
case ReleaseRHEL:
Expand Down
5 changes: 2 additions & 3 deletions templates/centos.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ FROM {{ .Image }} AS rootfs

USER root

{{ $version := atoi .Release.VersionID }}

{{ if le $version 8 }}
{{ if and (eq .Release.ID "centos") (le (atoi .Release.VersionID) 8) }}
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
{{ end }}
Expand All @@ -19,6 +17,7 @@ RUN yum install -y \
systemctl enable NetworkManager && \
systemctl unmask systemd-remount-fs.service && \
systemctl unmask getty.target && \
mkdir -p /boot && \
find /boot -type l -exec rm {} \;

{{- if .GrubBIOS }}
Expand Down
Loading