-
Notifications
You must be signed in to change notification settings - Fork 97
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
Cache trivy #2910
Cache trivy #2910
Conversation
Fixes #2904 Signed-off-by: Dimitris Karakasilis <[email protected]>
c8c2917
to
fcb7698
Compare
Signed-off-by: Dimitris Karakasilis <[email protected]>
I don't understand at which point the cache is saved. Looking at this pipeline: https://github.com/yogeshlonkar/trivy-cache-action/blob/5e3c2d406dd3a13d95a3eabc520e0ac19ab729b5/.github/workflows/workflow.yml#L48 |
Signed-off-by: Dimitris Karakasilis <[email protected]>
because if there is no cache to restore, the directory doesn't get created Signed-off-by: Dimitris Karakasilis <[email protected]>
6b1fb64
to
4d6ec2b
Compare
to avoid failing later. Also, since jobs run in parallel, they may start populating the cache at the same time which will result in multiple requests for the trivy database, making the caching mechanism useless. Doing it once before everything should solve this. Signed-off-by: Dimitris Karakasilis <[email protected]>
4d6ec2b
to
67fb41c
Compare
Found it. So this solution works like this: At the beginning of the pipeline and before any workflows request the trivy database:
After this is done, we are sure we have populated the GitHub cache with the latest db. From there on, any workflow that needs the trivy cache, will run the |
Fixes #2904
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #