-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the SBOM merge script to handle the newer metadata.tools format #448
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? cachi2/tests/integration/utils.py Lines 33 to 35 in eb4cb6c
|
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor nitpicks
utils/merge_syft_sbom.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: unnecessary elif condition
or missing else: explode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a else: explode
.
utils/merge_syft_sbom.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
if type(syft_tools) is dict: | |
if isinstance(syft_tools, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
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 <[email protected]>
db1edd5
to
dccda6b
Compare
6129c17
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