-
Notifications
You must be signed in to change notification settings - Fork 506
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
BOM: Include full list of transient go dependencies #2085
Conversation
/milestone v1.22 |
f4ad8e0
to
dfa6cbc
Compare
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.
Just a few nits, but generally LGTM :)
pkg/spdx/package.go
Outdated
@@ -189,6 +222,7 @@ func (p *Package) Render() (docFragment string, err error) { | |||
} | |||
|
|||
// If files were analyzed, calculate the verification | |||
filesTagList := map[string]*struct{}{} |
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.
Can we make this a []string
?
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.
Done. One question: I use that map of empty structs a lot as a temp dict to look up things that have to be listed once instead of looping a slice over and over.
Is it more efficient to loop the slice?
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.
Is it more efficient to loop the slice?
In theory yes, but practically I don't know.
This commit makes the go module download code parallel. It also fixes a bug where the temprary go downlaods were not removed correctly. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit reduces the verbosity of the license package by shifting some of the output to the debug level. It also fixes a bug where a division by zero may occur when reporting the number of licenses found. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit modofies the behaviour of bom when scanning go modules to include all transient dependencies. All modules included in the as transient dependencies as reported by go list will now be included in the sbom. This commit also includes new code to take advantage of the local go module cache. When scanning gp package licenses, bom will use any packages already downloaded and determine the licensins information from there before attempting to download the modules. This PR also includes a new flag to `bom generate`: `--no-transient` When defined, this flag will revert to the original behvaiour where only direct go dependencies are included in the Bill of Materials. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit also simplifies the data structure used to determine the LicenseInfoFromFiles entry in the PSDX package. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: puerco, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
#2077 is merged |
What type of PR is this?
/kind bug
/kind cleanup
/kind feature
/kind design
What this PR does / why we need it:
Full List of Dependencies is now the Default
Based on the discussion on #2077 this PR modifies the way we determine dependencies when scanning directories that contain go modules. All modules pulled by go as transient dependencies will now be included in the SBOM. The dependencies are determined by running
go -list --deps
.This PR also includes code to take advantage of the local go
module cache. When scanning go package licenses,
bom
will use anypackages already downloaded and determine the licensing information
from there before attempting to download the modules. This results in a considerable performance improvement.
A new flag is introduced to
bom generate
:--no-transient
When set, this flag will revert to the original behvaior where only direct go dependencies are included in the Bill of Materials.
Parallel Downloads
When
bom
has to download go dependencies, all downloads will now be done in parallel, also resulting in a considerable performance improvement.License package bugfix
Finally, a bug in the license package has been fixed, avoiding an edge case where a division by zero would crash the program under certain cases. Also, the license output has been improved by shifting some of the output to log level debug.
Which issue(s) this PR fixes:
Part of #1837
Follow up to: #2077
Special notes for your reviewer:
Only the last 4 commits are relevant, needs a rebase once #2077 merges.
Hold until 2077 merged
/hold
Does this PR introduce a user-facing change?