Skip to content
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

Convert our SPDX SBOMs to spdx+json. #740

Merged
merged 9 commits into from
Jul 1, 2022
Merged

Conversation

mattmoor
Copy link
Collaborator

@mattmoor mattmoor commented Jul 1, 2022

I mapped all of the fields from what we had to the new struct.

cc @imjasonh @jonjohnsonjr @puerco

@codecov-commenter
Copy link

codecov-commenter commented Jul 1, 2022

Codecov Report

Merging #740 (2cacf57) into main (a61e14d) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #740   +/-   ##
=======================================
  Coverage   51.38%   51.38%           
=======================================
  Files          44       44           
  Lines        3295     3295           
=======================================
  Hits         1693     1693           
  Misses       1390     1390           
  Partials      212      212           
Impacted Files Coverage Δ
pkg/build/gobuild.go 61.44% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a61e14d...2cacf57. Read the comment docs.

Copy link
Contributor

@puerco puerco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Matt, just a small nit 👇

internal/sbom/spdx.go Outdated Show resolved Hide resolved

java -jar ./spdx-tools-2.2.7-jar-with-dependencies.jar Verify sbom.txt
java -jar ./spdx-tools-2.2.7-jar-with-dependencies.jar Verify sbom.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This jar has been deprecated for the new version of the tools. The new URL to download the new jar is:
https://github.com/spdx/tools-java/releases/download/v1.0.4/tools-java-1.0.4.zip

(the version is lower but the jar is newer)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a big help, I think it caught a bunch of things we'd missed with the old tool 🙏

Name: bi.Main.Path,
ID: mainPackageID,
// TODO: PackageSupplier: "Organization: " + bs.Main.Path
DownloadLocation: "https://" + bi.Main.Path,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't very likely to work. Can we make this a proxy.golang.org URL? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal/sbom/spdx.go Outdated Show resolved Hide resolved
internal/sbom/spdx.go Outdated Show resolved Hide resolved
internal/sbom/spdx.go Show resolved Hide resolved
Version = "SPDX-2.2"
)

type Document struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit since it's internal anyway but these types can be unexported

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to avoid touching this code too much. I was about to change, but remembered this is in internal/ so I'm sort of inclined to leave it. WDYT?

Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! I agree this isn't any worse than what we had before, and the JSON seems a lot easier to consume. Anything else remaining can be cleaned up in a future PR.

@mattmoor mattmoor merged commit 12e5001 into ko-build:main Jul 1, 2022
@mattmoor mattmoor deleted the spdx-json branch July 1, 2022 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants