-
Notifications
You must be signed in to change notification settings - Fork 173
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
Create SBOMs for images pulled during package creation #367
Conversation
Relevant pr: in-toto/witness#167 |
3881122
to
20b918e
Compare
This is going to need some more work before we can merge it. We will need to have an ADR on the libs we pulled in (it adds multiple deps and increases the binary size by > 10%) as well as a test to verify it's being created. Also not sure what's going on with the |
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.
As already stated, will need ADR/Docs/Tests and items discussed below. I also noticed SBOM generation can take quite a while, any comments on performance or possible future improvements for that?
I've been working on the adr/docs/test, will get something in hsortly. I can do some tracing to see what part of the process is taking time and identify areas for improvement. |
That would be super helpful, thanks! |
Ran some quick tests today profiling sbom generation on Here's a flame graph of the sbom code on a run with a cold image cache The total run time of sbom.CatalogImages was 11.19 seconds. And here's a flame graph for the same package but with a hot cache The total run time of sbom.CatalogImages was 4.57 seconds. From the flame graphs it appears that it's rebuilding the image tar from the layer cache instead of just using the cache directly as I hoped it would. This explains why sbom generation is much faster on subsequent runs for the same image since the tar is already built. Simplest fix will be to try to get the cataloger to use the layer cache directories directly instead of re-building the image's tar file. |
I spent the last bit chasing down performance improvements. I'll get the ADR and documentation in asap this week while I continue working tests and performance issues. |
This still needs docs/tests, any updates on your end @mikhailswift? |
Sound good to me, will get the docs & tests in asap this week. I was looking at similar, either generating a static html page or starting a web server from zarf that allowed navigation of the sbom. Look like you got a good start on it. I'm still investigating performance concerns regarding the first time building SBOMs for an image. It seems like syft is maintaining it's own cache and not using the layer cache that zarf creates on pull which is causing the slow downs. I think I may have a way forward on a solution. |
TIL some ppl daydream about SBOM while getting groceries... |
Send help please |
Okay, I'm doing some last rounds of testing but I believe I've got the performance of generating the SBOMs improved significantly: Both of the below timings were measured with .zarf-image-cache erased for a cold run of the single-big-bang-package exampoe Current code:
Not a precise measurement but watching the timer on the SBOM step seemed to take ~30 seconds Changed:
Same imprecise measurement as above but the SBOM step seemed to take ~10 seconds. Image pull on both examples took about 30 seconds. Of note is the increased CPU percentage: 38% of the elapsed time was spent on the CPU while 57% was spent on the CPU in the updated code -- indicating less time spent on IO Looking at cpuprofile comparisons again, Current code: In this case In this case image.Read is taking ~22% of the cpu time in CatalogImages, but no tls calls happen. Will have this + docs & tests pushed today |
added some basic docs and updates to the adr. worked a bit on presentation: 1d5d02f That is very much a hacky work in progress, though |
@Madeline-UX |
* Create SBOMs for images while creating packages * docs: add adr for sbom capability * Use existing multi-image tars when generating SBOMs during package create * docs: add basic sbom docs * add sbom html viewer generator * Use gotemplate for sbom viewer and make each html file standalone/portable * Add deploy prompt for SBOM Co-authored-by: Jeff McCoy <[email protected]>
Description
Creates SBOMs for all images pulled during
zarf package create
. Stores them in a sboms directory within the package.Related Issue
Fixes #22
Type of change
Checklist before merging
needs-tests
label)needs-docs
label)needs-adr
label) [ 1 2 3 ]