-
Notifications
You must be signed in to change notification settings - Fork 19
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
[ISSUE 435] Fix vulnerability checks #452
Conversation
051951e
to
eec8a1f
Compare
366c03e
to
5b1dbef
Compare
b8e6ed3
to
e12e855
Compare
e12e855
to
215d7ac
Compare
71d8134
to
63801cf
Compare
83e3247
to
22698af
Compare
22698af
to
102e517
Compare
0688ce0
to
91e32e3
Compare
91e32e3
to
341befb
Compare
2b1f84d
to
c07a116
Compare
…at if cache wasn't hit
1f65498
to
1ff7e81
Compare
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.
This looks great, I was checking other ci-vulnerability-scans and seems like even when it doesn't have it in the cache it takes a 7ish minute run down to 3ish minute run!
One note regarding the cache limit, seems like github deletes older entries from the cache automatically after exceeding 10gb or 7 days, so this run should be fine, but I noticed another workflow uses the cache ci-frontend.yml, but I don't think it will be a problem. If it does, we could consider adding a step to delete the items from the cache: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy
@@ -1,8 +1,6 @@ | |||
# GitHub Actions CI workflow that runs vulnerability scans on the application's Docker image | |||
# to ensure images built are secure before they are deployed. | |||
|
|||
# NOTE: The workflow isn't able to pass the docker image between jobs, so each builds the image. | |||
# A future PR will pass the image between the scans to reduce overhead and increase speed |
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.
nice!
trivy-scan: | ||
name: Trivy Scan | ||
runs-on: ubuntu-latest | ||
needs: build-and-cache |
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.
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.
This is great!
Summary
Fixes #435
Time to review: 15 mins
Changes proposed
Use caching strategy to pass docker image between scan jobs and also for faster builds with docker layer caching. Seems like Docker build time is more than halved.
Context for reviewers
Observe action output as test.
Other strategies to share image across jobs were slow 🐌
Comments & Questions
Is this worth it? The time-to-run halved (~2 min to <=1 min) and it is a gateway to better outcomes if we leverage build caching across workflows as an end goal someday. What that looks like might become clearer when work is done on [Task]: Fix deploy Github Actions workflow #406.
Do we need to invalidate the caches, will it fill up quickly because we are using it short-term or will it get managed automagically?
https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policyhttps://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
Before (2 mins 18 secs)
With cached layers (46 secs)
With cache-hit == true (10 secs)