Skip to content

Commit a78ccb3

Browse files
authored
Merge pull request #890 from hbeberman/hbeberman/add_mariner_azurelinux
Add support for CBL-Mariner and Azure Linux
2 parents 1626b85 + fda3234 commit a78ccb3

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

Diff for: pkg/util/helpers_linux.go

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func getOSVersion(osReleasePath string) (string, error) {
6464
return getDebianVersion(osReleaseMap), nil
6565
case "sles":
6666
return getDebianVersion(osReleaseMap), nil
67+
case "mariner":
68+
return getDebianVersion(osReleaseMap), nil
69+
case "azurelinux":
70+
return getDebianVersion(osReleaseMap), nil
6771
default:
6872
return "", fmt.Errorf("Unsupported ID in /etc/os-release: %q", osReleaseMap["ID"])
6973
}

Diff for: pkg/util/helpers_linux_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ func TestGetOSVersionLinux(t *testing.T) {
7575
expectedOSVersion: "sles 15-SP4",
7676
expectErr: false,
7777
},
78+
{
79+
name: "mariner",
80+
fakeOSReleasePath: "testdata/os-release-mariner",
81+
expectedOSVersion: "mariner 2.0.20240123",
82+
expectErr: false,
83+
},
84+
{
85+
name: "azurelinux",
86+
fakeOSReleasePath: "testdata/os-release-azurelinux",
87+
expectedOSVersion: "azurelinux 3.0.20240328",
88+
expectErr: false,
89+
},
7890
{
7991
name: "Unknown",
8092
fakeOSReleasePath: "testdata/os-release-unknown",

Diff for: pkg/util/testdata/os-release-azurelinux

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NAME="Microsoft Azure Linux"
2+
VERSION="3.0.20240328"
3+
ID=azurelinux
4+
VERSION_ID="3.0"
5+
PRETTY_NAME="Microsoft Azure Linux 3.0"
6+
ANSI_COLOR="1;34"
7+
HOME_URL="https://aka.ms/azurelinux"
8+
BUG_REPORT_URL="https://aka.ms/azurelinux"
9+
SUPPORT_URL="https://aka.ms/azurelinux"

Diff for: pkg/util/testdata/os-release-mariner

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NAME="Common Base Linux Mariner"
2+
VERSION="2.0.20240123"
3+
ID=mariner
4+
VERSION_ID="2.0"
5+
PRETTY_NAME="CBL-Mariner/Linux"
6+
ANSI_COLOR="1;34"
7+
HOME_URL="https://aka.ms/cbl-mariner"
8+
BUG_REPORT_URL="https://aka.ms/cbl-mariner"
9+
SUPPORT_URL="https://aka.ms/cbl-mariner"

0 commit comments

Comments
 (0)