fix(redhat): don't return error if root/buildinfo/content_manifests/ contains files that are not contentSets files (#7912)

This commit is contained in:
DmitriyLewen
2024-11-18 13:42:24 +06:00
committed by GitHub
parent a5f0ef5e78
commit 38775a5ed9
3 changed files with 18 additions and 0 deletions

View File

@@ -31,6 +31,10 @@ func (a contentManifestAnalyzer) Analyze(_ context.Context, target analyzer.Anal
return nil, xerrors.Errorf("invalid content manifest: %w", err)
}
if len(manifest.ContentSets) == 0 {
return nil, nil
}
return &analyzer.AnalysisResult{
BuildInfo: &types.BuildInfo{
ContentSets: manifest.ContentSets,

View File

@@ -31,6 +31,11 @@ func Test_contentManifestAnalyzer_Analyze(t *testing.T) {
},
},
},
{
name: "happy path for non-contentSets file",
input: "testdata/content_manifests/sbom-purl.json",
want: nil,
},
{
name: "broken json",
input: "testdata/content_manifests/broken.json",

View File

@@ -0,0 +1,9 @@
{
"image_contents": {
"dependencies": [
{
"purl": "pkg:rpm/redhat/zstd@1.5.1-2.el9?arch=src&checksum=sha256:f1ddea14d19746b867e69b48d128dd9c2d3e8cc021a5ea7b0674b48356ad3341&repository_id=rhel-9-base-source"
}
]
}
}