Skip to content

Commit

Permalink
Nest source metadata in BOM
Browse files Browse the repository at this point in the history
Signed-off-by: Forest Eckhardt <[email protected]>
  • Loading branch information
Sophie Wigmore authored and ryanmoran committed Jul 28, 2021
1 parent ec93346 commit c5a4051
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
14 changes: 8 additions & 6 deletions postal/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,14 @@ func (s Service) GenerateBillOfMaterials(dependencies ...Dependency) []packit.BO
entry := packit.BOMEntry{
Name: dependency.Name,
Metadata: map[string]interface{}{
"sha256": dependency.SHA256,
"source": dependency.Source,
"source-sha256": dependency.SourceSHA256,
"stacks": dependency.Stacks,
"uri": dependency.URI,
"version": dependency.Version,
"sha256": dependency.SHA256,
"source": map[string]string{
"sha256": dependency.SourceSHA256,
"uri": dependency.Source,
},
"stacks": dependency.Stacks,
"uri": dependency.URI,
"version": dependency.Version,
},
}

Expand Down
88 changes: 50 additions & 38 deletions postal/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,23 +985,27 @@ version = "this is super not semver"
{
Name: "Some Entry",
Metadata: map[string]interface{}{
"sha256": "some-sha",
"source": "some-source",
"source-sha256": "some-source-sha",
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
"sha256": "some-sha",
"source": map[string]string{
"sha256": "some-source-sha",
"uri": "some-source",
},
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
},
},
{
Name: "Other Entry",
Metadata: map[string]interface{}{
"sha256": "other-sha",
"source": "other-source",
"source-sha256": "other-source-sha",
"stacks": []string{"other-stack"},
"uri": "other-uri",
"version": "4.5.6",
"sha256": "other-sha",
"source": map[string]string{
"sha256": "other-source-sha",
"uri": "other-source",
},
"stacks": []string{"other-stack"},
"uri": "other-uri",
"version": "4.5.6",
},
},
}))
Expand All @@ -1027,13 +1031,15 @@ version = "this is super not semver"
{
Name: "Some Entry",
Metadata: map[string]interface{}{
"cpe": "some-cpe",
"sha256": "some-sha",
"source": "some-source",
"source-sha256": "some-source-sha",
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
"cpe": "some-cpe",
"sha256": "some-sha",
"source": map[string]string{
"sha256": "some-source-sha",
"uri": "some-source",
},
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
},
},
}))
Expand Down Expand Up @@ -1070,11 +1076,13 @@ version = "this is super not semver"
Metadata: map[string]interface{}{
"deprecation-date": deprecationDate,
"sha256": "some-sha",
"source": "some-source",
"source-sha256": "some-source-sha",
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
"source": map[string]string{
"sha256": "some-source-sha",
"uri": "some-source",
},
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
},
},
}))
Expand All @@ -1101,13 +1109,15 @@ version = "this is super not semver"
{
Name: "Some Entry",
Metadata: map[string]interface{}{
"licenses": []string{"some-license"},
"sha256": "some-sha",
"source": "some-source",
"source-sha256": "some-source-sha",
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
"licenses": []string{"some-license"},
"sha256": "some-sha",
"source": map[string]string{
"sha256": "some-source-sha",
"uri": "some-source",
},
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
},
},
}))
Expand All @@ -1134,13 +1144,15 @@ version = "this is super not semver"
{
Name: "Some Entry",
Metadata: map[string]interface{}{
"purl": "some-purl",
"sha256": "some-sha",
"source": "some-source",
"source-sha256": "some-source-sha",
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
"purl": "some-purl",
"sha256": "some-sha",
"source": map[string]string{
"sha256": "some-source-sha",
"uri": "some-source",
},
"stacks": []string{"some-stack"},
"uri": "some-uri",
"version": "1.2.3",
},
},
}))
Expand Down

0 comments on commit c5a4051

Please sign in to comment.