Skip to content

Commit

Permalink
feat: add rocky linux support (project-copacetic#605)
Browse files Browse the repository at this point in the history
Signed-off-by: Miaha Cybersec <[email protected]>
Signed-off-by: Miaha <[email protected]>
Co-authored-by: Sertaç Özercan <[email protected]>
Co-authored-by: Ashna Mehrotra <[email protected]>
  • Loading branch information
3 people authored May 10, 2024
1 parent 64a71e9 commit a8c073e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
8 changes: 8 additions & 0 deletions integration/fixtures/test-images-non-distroless.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
"description": "Valid rpm DB, yum present",
"ignoreErrors": false
},
{
"image": "docker.io/library/rockylinux",
"tag": "8.9.20231119",
"digest": "sha256:69cecc7163282ad83e27b739fe8473b7c56e280e83827dcda60e5d37102457f1",
"distro": "Rocky Linux",
"description": "Valid rpm DB, yum present",
"ignoreErrors": false
},
{
"image": "docker.io/grafana/grafana-image-renderer",
"tag" : "3.4.0",
Expand Down
8 changes: 8 additions & 0 deletions integration/fixtures/test-images.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
"description": "Valid rpm DB, yum present",
"ignoreErrors": false
},
{
"image": "docker.io/library/rockylinux",
"tag": "8.9.20231119",
"digest": "sha256:69cecc7163282ad83e27b739fe8473b7c56e280e83827dcda60e5d37102457f1",
"distro": "Rocky Linux",
"description": "Valid rpm DB, yum present",
"ignoreErrors": false
},
{
"image": "docker.io/grafana/grafana-image-renderer",
"tag" : "3.4.0",
Expand Down
2 changes: 2 additions & 0 deletions pkg/patch/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ func getOSType(ctx context.Context, osreleaseBytes []byte) (string, error) {
return "cbl-mariner", nil
case strings.Contains(osType, "red hat"):
return "redhat", nil
case strings.Contains(osType, "rocky"):
return "rocky", nil
default:
log.Error("unsupported osType", osType)
return "", errors.ErrUnsupported
Expand Down
21 changes: 21 additions & 0 deletions pkg/patch/patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ func TestGetOSType(t *testing.T) {
err: nil,
expectedOSType: "redhat",
},
{
osRelease: []byte(`NAME="Rocky Linux"
VERSION="9.3 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.3 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.3"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"`),
err: nil,
expectedOSType: "rocky",
},
{
osRelease: nil,
err: errors.ErrUnsupported,
Expand Down
2 changes: 1 addition & 1 deletion pkg/pkgmgr/pkgmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func GetPackageManager(osType string, config *buildkit.Config, workingFolder str
return &apkManager{config: config, workingFolder: workingFolder}, nil
case "debian", "ubuntu":
return &dpkgManager{config: config, workingFolder: workingFolder}, nil
case "cbl-mariner", "centos", "redhat", "amazon":
case "cbl-mariner", "centos", "redhat", "rocky", "amazon":
return &rpmManager{config: config, workingFolder: workingFolder}, nil
default:
return nil, fmt.Errorf("unsupported osType %s specified", osType)
Expand Down

0 comments on commit a8c073e

Please sign in to comment.