Skip to content

Commit

Permalink
feat: add centos and amazon linux support (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
sozercan committed Apr 26, 2023
1 parent 74ae03e commit 6ac6922
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test-images.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,17 @@
"tag": "2.0.20220527",
"distro": "Mariner Distroless",
"description": "Custom rpmmanifest files, no yum/dnf/microdnf/rpm"
},
{
"image": "docker.io/library/centos",
"tag": "7.6.1810",
"distro": "CentOS",
"description": "Valid rpm DB, yum present"
},
{
"image": "docker.io/library/amazonlinux",
"tag": "2.0.20210326.0",
"distro": "Amazon Linux",
"description": "Valid rpm DB, yum present"
}
]
8 changes: 2 additions & 6 deletions pkg/pkgmgr/pkgmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ func GetPackageManager(osType string, config *buildkit.Config, workingFolder str
switch osType {
case "alpine":
return &apkManager{config: config, workingFolder: workingFolder}, nil
case "debian":
fallthrough
case "ubuntu":
case "debian", "ubuntu":
return &dpkgManager{config: config, workingFolder: workingFolder}, nil
case "cbl-mariner":
fallthrough
case "redhat":
case "cbl-mariner", "centos", "redhat", "amazon":
return &rpmManager{config: config, workingFolder: workingFolder}, nil
default:
return nil, fmt.Errorf("unsupported osType %s specified", osType)
Expand Down
5 changes: 3 additions & 2 deletions pkg/pkgmgr/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ func (rm *rpmManager) probeRPMStatus(ctx context.Context, toolImage string) erro
outStatePath := filepath.Join(rm.workingFolder, resultsPath)
rpmDB := getRPMDBType(outStatePath)
log.Debugf("RPM DB Type in image is: %s", rpmDB)
if rpmDB == RPMDBManifests {
switch rpmDB {
case RPMDBManifests:
rm.isDistroless = true
} else if rpmDB == RPMDBNone || rpmDB == RPMDBMixed {
case RPMDBNone, RPMDBMixed:
err := fmt.Errorf("could not find determine RPM DB type of target image: %v", rpmDB)
log.Error(err)
return err
Expand Down

0 comments on commit 6ac6922

Please sign in to comment.