Skip to content

Commit

Permalink
Add support for CBL-Mariner and Azure Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
hbeberman committed Mar 28, 2024
1 parent d4aa574 commit fda3234
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/util/helpers_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func getOSVersion(osReleasePath string) (string, error) {
return getDebianVersion(osReleaseMap), nil
case "sles":
return getDebianVersion(osReleaseMap), nil
case "mariner":
return getDebianVersion(osReleaseMap), nil
case "azurelinux":
return getDebianVersion(osReleaseMap), nil
default:
return "", fmt.Errorf("Unsupported ID in /etc/os-release: %q", osReleaseMap["ID"])
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/util/helpers_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ func TestGetOSVersionLinux(t *testing.T) {
expectedOSVersion: "sles 15-SP4",
expectErr: false,
},
{
name: "mariner",
fakeOSReleasePath: "testdata/os-release-mariner",
expectedOSVersion: "mariner 2.0.20240123",
expectErr: false,
},
{
name: "azurelinux",
fakeOSReleasePath: "testdata/os-release-azurelinux",
expectedOSVersion: "azurelinux 3.0.20240328",
expectErr: false,
},
{
name: "Unknown",
fakeOSReleasePath: "testdata/os-release-unknown",
Expand Down
9 changes: 9 additions & 0 deletions pkg/util/testdata/os-release-azurelinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NAME="Microsoft Azure Linux"
VERSION="3.0.20240328"
ID=azurelinux
VERSION_ID="3.0"
PRETTY_NAME="Microsoft Azure Linux 3.0"
ANSI_COLOR="1;34"
HOME_URL="https://aka.ms/azurelinux"
BUG_REPORT_URL="https://aka.ms/azurelinux"
SUPPORT_URL="https://aka.ms/azurelinux"
9 changes: 9 additions & 0 deletions pkg/util/testdata/os-release-mariner
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NAME="Common Base Linux Mariner"
VERSION="2.0.20240123"
ID=mariner
VERSION_ID="2.0"
PRETTY_NAME="CBL-Mariner/Linux"
ANSI_COLOR="1;34"
HOME_URL="https://aka.ms/cbl-mariner"
BUG_REPORT_URL="https://aka.ms/cbl-mariner"
SUPPORT_URL="https://aka.ms/cbl-mariner"

0 comments on commit fda3234

Please sign in to comment.