Skip to content

Commit 38775a5

Browse files
authored
fix(redhat): don't return error if root/buildinfo/content_manifests/ contains files that are not contentSets files (#7912)
1 parent a5f0ef5 commit 38775a5

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

pkg/fanal/analyzer/buildinfo/content_manifest.go

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ func (a contentManifestAnalyzer) Analyze(_ context.Context, target analyzer.Anal
3131
return nil, xerrors.Errorf("invalid content manifest: %w", err)
3232
}
3333

34+
if len(manifest.ContentSets) == 0 {
35+
return nil, nil
36+
}
37+
3438
return &analyzer.AnalysisResult{
3539
BuildInfo: &types.BuildInfo{
3640
ContentSets: manifest.ContentSets,

pkg/fanal/analyzer/buildinfo/content_manifest_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func Test_contentManifestAnalyzer_Analyze(t *testing.T) {
3131
},
3232
},
3333
},
34+
{
35+
name: "happy path for non-contentSets file",
36+
input: "testdata/content_manifests/sbom-purl.json",
37+
want: nil,
38+
},
3439
{
3540
name: "broken json",
3641
input: "testdata/content_manifests/broken.json",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"image_contents": {
3+
"dependencies": [
4+
{
5+
"purl": "pkg:rpm/redhat/[email protected]?arch=src&checksum=sha256:f1ddea14d19746b867e69b48d128dd9c2d3e8cc021a5ea7b0674b48356ad3341&repository_id=rhel-9-base-source"
6+
}
7+
]
8+
}
9+
}

0 commit comments

Comments
 (0)