-
Notifications
You must be signed in to change notification settings - Fork 599
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
refactor: move formats from internal into syft module #1172
Conversation
Signed-off-by: cpendery <[email protected]>
Signed-off-by: cpendery <[email protected]>
I think I'm ok with interface here for now considering the overhead of the generic work. cc @wagoodman since he usually has the final say when it comes to updating the interface types. Code LGTM - I think just the consideration is worth the second pair of eyes. |
@cpendery thanks for attending the community meeting to add context to this change -- do you have a specific format you're dealing with and would it just be easier to export the right conversion functions by moving these formatters to the top-level |
I'm just working with the cyclonedx and spdx models. Just exposing the ToSyftModel function outside internal would be great and is all I actually need |
@cpendery would you like to take a stab at the refactoring? If not, I could probably do this in the next day or two. |
I can refactor the pr and just pull out the formats package 👍 |
Signed-off-by: cpendery <[email protected]> This reverts commit 6df5bec.
Signed-off-by: cpendery <[email protected]> This reverts commit 0d55b59.
Signed-off-by: cpendery <[email protected]>
6a77416
to
c634d2c
Compare
Signed-off-by: Patrik Beno <[email protected]>
* main: bug: remove chance for panic; provide default attestation path (anchore#1214) refactor: update Makefile organization; update DEVELOPING.md instructions (anchore#1212) refactor: replace ioutil=>io; update linter (anchore#1211) Update bootstrap tools to latest versions. (anchore#1204) Add gosimports (anchore#1205) refactor: move formats from internal into syft module (anchore#1172) warn on errors from RPM DB parsing (anchore#1200) docs: improve Singularity image source docs (anchore#1190) Signed-off-by: Christopher Phillips <[email protected]>
Signed-off-by: Christopher Phillips <[email protected]>
Signed-off-by: Christopher Phillips <[email protected]>
Signed-off-by: Patrik Beno <[email protected]>
Signed-off-by: Patrik Beno <[email protected]>
* SBOM cataloger Signed-off-by: Patrik Beno <[email protected]> * sbom-cataloger: turn off by default and add integration test Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (optimize) Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (fix) Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (fix imports #1172) Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (fix: support group attribute in CDX SBOMs) Signed-off-by: Patrik Beno <[email protected]> * port to generic cataloger and add relationship to original file Signed-off-by: Alex Goodman <[email protected]> * generalize parser for all format globs Signed-off-by: Alex Goodman <[email protected]> Signed-off-by: Patrik Beno <[email protected]> Signed-off-by: Alex Goodman <[email protected]> Co-authored-by: Tom Fay <[email protected]> Co-authored-by: Alex Goodman <[email protected]>
* SBOM cataloger Signed-off-by: Patrik Beno <[email protected]> * sbom-cataloger: turn off by default and add integration test Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (optimize) Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (fix) Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (fix imports anchore#1172) Signed-off-by: Patrik Beno <[email protected]> * SBOM cataloger (fix: support group attribute in CDX SBOMs) Signed-off-by: Patrik Beno <[email protected]> * port to generic cataloger and add relationship to original file Signed-off-by: Alex Goodman <[email protected]> * generalize parser for all format globs Signed-off-by: Alex Goodman <[email protected]> Signed-off-by: Patrik Beno <[email protected]> Signed-off-by: Alex Goodman <[email protected]> Co-authored-by: Tom Fay <[email protected]> Co-authored-by: Alex Goodman <[email protected]>
Description
This pr enables the
spdx
andcyclonedx
formatters to be called directly with those external libraries objects. Currently, if you build an sbom using these structs, you have to marshal it into json and then pass the reader to be un-marshaled and parsed into Syft's intermediate representation, causing wasted computations, especially when working with large SBOMs.The often comes into play when calling Syft to produces packages for Grype's api methods.
Considerations:
Don't use
interface{}
: I agree, but fully using generics got a bit out of hand considering theFormat
struct is quite widely used. Happy to refactor as desired, like just using an interface of a union of two known types