Skip to content

Commit 7dd70dc

Browse files
fix(redhat): don't return error if root/buildinfo/content_manifests/ contains files that are not contentSets files [backport: release/v0.57] (#7939)
Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com> Co-authored-by: DmitriyLewen <dmitriy.lewen@smartforce.io>
1 parent 3d537b9 commit 7dd70dc

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/zstd@1.5.1-2.el9?arch=src&checksum=sha256:f1ddea14d19746b867e69b48d128dd9c2d3e8cc021a5ea7b0674b48356ad3341&repository_id=rhel-9-base-source"
6+
}
7+
]
8+
}
9+
}

0 commit comments

Comments
 (0)