Merged
Conversation
76ee567 to
658b244
Compare
dvail
commented
Jul 19, 2024
4 tasks
davdhacs
approved these changes
Jul 25, 2024
davdhacs
left a comment
There was a problem hiding this comment.
+1
I ran the ossls built from this against stackrox master and stackrox/stackrox#11967 and compared the THIRD_PARTY_NOTICES.
$ go build && mv ossls ~/.local/bin
$ cd ../stackrox
$ make ossls-notice
$ ls -1 image/rhel/THIRD_PARTY_NOTICES | tee yarn.3rdparty.list
$ git switch dv/ROX-25287-replace-yarn-w-npm-for-konflux
$ rm -rf image/rhel/THIRD_PARTY_NOTICES
# un-comment npm lines in .ossls.yml
$ make -C ui clean deps
$ make ossls-notice
$ ls -1 image/rhel/THIRD_PARTY_NOTICES | tee npm.3rdparty.list
RTann
reviewed
Jul 25, 2024
RTann
reviewed
Jul 26, 2024
RTann
approved these changes
Jul 26, 2024
RTann
left a comment
There was a problem hiding this comment.
Since this isn't a main part of the product, I won't keep going with nitpicks. If it works, it works :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for npm's
package-lock.json(v3) as an alternative to yarn's customyarn.lockfile. This would allow the stackrox UI to drop yarn in favor of npm in order to enable hermetic builds in the konflux pipelines.This update includes dev dependencies as well as nested transitive dependencies in the output. Essentially if a module is resolved somewhere in the application's
node_modulesfolder, it will be included in the ossls notice output with a LICENSE file and license.json metadata. It would not be difficult to drop either of these dependency categories if needed, but I didn't see the harm in including them.(As an aside, this means the dependencies included by the current yarn version could change depending on how the tree is resolved. e.g. If we depend on
yaml1.7.2at the top level andyaml2.2.1as a nested dependency, the latter would not be included in the license output. In theory a dependency change could invert the two, in which case the former would not be included in the output.)How it works
The npm package-lock.json v3 contains a
packageskey with a value object where:"", which contains metadata about the root project. This is ignored."node_modules/<package-name>"or"node_modules/<package-name>/node_modules/<nested-package-name>". The values to these keys contain metadata about the package, the only data which we care about being theversionfield.This code update reads all of the keys from 2 above and treats:
node_modulessegments as the expected path of the module on disk"node_modules"segment as the package nameversionfield of the object as the package versionOnce the paths, names, and versions for all modules are obtained, control is returned back to the existing ossls code which then reads metadata and license information for all of these packages and outputs the results on disk.
Testing
Manual testing against the full
package-lock.jsonin stackrox/stackrox#11967 and compare to similar output against the yarn equivalent instackrox@master.Automated unit test included with this PR.