Skip to content

Add support for CBL-Mariner and Azure Linux #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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 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"