Update the SBOM merge script to handle the newer metadata.tools format#448
Conversation
|
We should probably also create a mechanism to add the current Cachi2 version to the metadata.tools output: |
21a08f5 to
b1afb7c
Compare
|
Do we need to bump the schema version we're using in the integration tests? https://github.com/containerbuildsystem/cachi2/blob/eb4cb6c9bd2dedbd8cd766c086fa16db290ffbfb/tests/integration/utils.py#L33-L35 |
b1afb7c to
2b46376
Compare
20ddee2 to
286972e
Compare
|
New pushes: added a commit that updates the |
|
Blocks konflux-ci/build-definitions#722, which blocks the latest rh-syft build (Syft < 0.99.0 panics when processing the source directory of Syft >= 0.99.0) |
e6f6f74 to
db1edd5
Compare
|
New push completely reworks the PR:
|
chmeliik
left a comment
There was a problem hiding this comment.
LGTM with minor nitpicks
| if type(syft_tools) is dict: | ||
| components = [] | ||
|
|
||
| for t in cachi2_tools: | ||
| components.append( | ||
| { | ||
| "author": t["vendor"], | ||
| "name": t["name"], | ||
| "type": "application", | ||
| } | ||
| ) | ||
|
|
||
| syft_tools["components"].extend(components) | ||
| elif type(syft_tools) is list: |
There was a problem hiding this comment.
nitpick: unnecessary elif condition
or missing else: explode
There was a problem hiding this comment.
Added a else: explode.
| syft_tools = syft_sbom["metadata"]["tools"] | ||
| cachi2_tools = cachi2_sbom["metadata"]["tools"] | ||
|
|
||
| if type(syft_tools) is dict: |
There was a problem hiding this comment.
nitpick:
| if type(syft_tools) is dict: | |
| if isinstance(syft_tools, dict): |
CycloneDX 1.5 changes the way to define tools in the metadata section, and marks the 1.4 way as deprecated. Syft has adopted the newer format starting from version 0.99.0. This makes the 'merge_syft_sbom.py' script to fail in case a newer Syft SBOM is used. This patch updates the script so both formats can be handled. It assumes the Cachi2 SBOM is in the 1.4 format. Signed-off-by: Bruno Pimentel <bpimente@redhat.com>
db1edd5 to
dccda6b
Compare
There's a new version of the CycloneDX (1.5) which introduced changes in the way to specify
.metadata.tools, and marks the current format as deprecated.CycloneDX 1.4:
CycloneDX 1.5:
Syft has also adopted the newer format starting from version 0.99.0. This makes the 'merge_syft_sbom.py' script to fail in case a newer Syft SBOM is used. This PR also updates the script so both formats can be handled in Syft SBOMs.
Maintainers will complete the following section