Merge pull request #13559 from hakman/rocky-8

Add support for Rocky Linux 8
This commit is contained in:
Kubernetes Prow Robot 2022-04-26 06:48:53 -07:00 committed by GitHub
commit b6e0c5fa29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 1 deletions

View File

@ -333,7 +333,7 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
args = []string{"apt-get", "install", "--yes", "--no-install-recommends"}
env = append(env, "DEBIAN_FRONTEND=noninteractive")
} else if d.IsRHELFamily() {
if d == distributions.DistributionRhel8 {
if d == distributions.DistributionRhel8 || d == distributions.DistributionRocky8 {
args = []string{"/usr/bin/dnf", "install", "-y", "--setopt=install_weak_deps=False"}
} else {
args = []string{"/usr/bin/yum", "install", "-y"}

View File

@ -47,6 +47,7 @@ var (
DistributionUbuntu2204 = Distribution{packageFormat: "deb", project: "ubuntu", id: "jammy", version: 22.04}
DistributionAmazonLinux2 = Distribution{packageFormat: "rpm", project: "amazonlinux2", id: "amazonlinux2", version: 0}
DistributionRhel8 = Distribution{packageFormat: "rpm", project: "rhel", id: "rhel8", version: 8}
DistributionRocky8 = Distribution{packageFormat: "rpm", project: "rocky", id: "rocky8", version: 8}
DistributionFlatcar = Distribution{packageFormat: "", project: "flatcar", id: "flatcar", version: 0}
DistributionContainerOS = Distribution{packageFormat: "", project: "containeros", id: "containeros", version: 0}
)
@ -82,6 +83,8 @@ func (d *Distribution) DefaultUsers() ([]string, error) {
return []string{"centos"}, nil
case "rhel", "amazonlinux2":
return []string{"ec2-user"}, nil
case "rocky":
return []string{"rocky"}, nil
case "flatcar":
return []string{"core"}, nil
default:

View File

@ -78,6 +78,9 @@ func FindDistribution(rootfs string) (Distribution, error) {
if strings.HasPrefix(distro, "rhel-8.") {
return DistributionRhel8, nil
}
if strings.HasPrefix(distro, "rocky-8.") {
return DistributionRocky8, nil
}
// Some distros are not supported
klog.V(2).Infof("Contents of /etc/os-release:\n%s", osReleaseBytes)

View File

@ -89,6 +89,11 @@ func TestFindDistribution(t *testing.T) {
err: nil,
expected: DistributionRhel8,
},
{
rootfs: "rocky8",
err: nil,
expected: DistributionRocky8,
},
{
rootfs: "ubuntu1604",
err: fmt.Errorf("unsupported distro: ubuntu-16.04"),

View File

@ -0,0 +1,13 @@
NAME="Rocky Linux"
VERSION="8.5 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.5 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8.5:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"