-
Notifications
You must be signed in to change notification settings - Fork 2.7k
refactor: use UUID/hash for Packages IDs from pom.xml
files.
#7879
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
base: main
Are you sure you want to change the base?
Conversation
pom.xml
files.pom.xml
files.
@@ -148,7 +148,8 @@ func (p *Parser) parseRoot(root artifact, uniqModules map[string]struct{}) ([]ft | |||
if _, ok := uniqModules[art.String()]; ok { | |||
continue | |||
} | |||
uniqModules[art.String()] = struct{}{} | |||
art.ID = uuid.New() |
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.
I want the output reports to be as reproducible as possible. I'm considering another approach, but I have not yet come up with...
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.
Do you mean using something like a hash instead of UUID?
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.
That's one of the options. Regardless of the method, I want the same value to be output as much as possible when scanning the same object.
This PR is stale because it has been labeled with inactivity. |
}, | ||
}, | ||
{ | ||
name: "multi module with similar deps, but different children", |
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.
@knqyf263 I updated logic to use hash instead of UUID and found 1 issue.
I added this test case to show:
Based on our logic (#7824 (comment)), we should use different IDs for all dependencies (because they can use different properties, depManagemets, etc.) - see org.example:example-dependency
in this example.
But we use GAV in cache key only, which leads to artifact reuse and wrong packages.
I see 2 ways:
- abandon cache
- save pom.xml files before analyze to cache (pom.xml instead of
analysisResult
). In this case we will gain time for reading pom.xml files, but I'm not sure that it will help much.
pom.xml
files.pom.xml
files.
This PR is stale because it has been labeled with inactivity. |
This PR is stale because it has been labeled with inactivity. |
Description
There are cases when report contains Packages with same
GAV
(GroupID, ArtifactID, version).But these are different packages (see #7824 (comment)).
To avoid confusing and build dependency graph correctly, we need to use
UUID
for each Package frompom.xml
files.This solution also fixes problem with relationships in SBOM formats for this case (see #7824 (comment))
PR blocker - #7889
Related issues
Related PR
workspaceRelationship
#7889Checklist