Skip to content
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

Merged
merged 20 commits into from
Sep 6, 2023

Conversation

daphnegold
Copy link
Contributor

@daphnegold daphnegold commented Aug 31, 2023

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 🐌

  • Push/pull from ECR
  • Upload/download GA artifact

Comments & Questions

Before (2 mins 18 secs)

Screenshot 2023-09-01 at 9 51 49 PM

With cached layers (46 secs)

Screenshot 2023-09-01 at 9 05 31 PM

With cache-hit == true (10 secs)

Screenshot 2023-09-01 at 9 06 19 PM

@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch 7 times, most recently from 051951e to eec8a1f Compare September 1, 2023 17:57
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch 6 times, most recently from 366c03e to 5b1dbef Compare September 1, 2023 19:43
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch 3 times, most recently from b8e6ed3 to e12e855 Compare September 1, 2023 21:05
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch from e12e855 to 215d7ac Compare September 1, 2023 21:10
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch from 71d8134 to 63801cf Compare September 1, 2023 21:47
@daphnegold daphnegold changed the title [ISSUE 435] Github Actions CI/CD flow [ISSUE 435] Fix vulnerability checks Sep 1, 2023
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch 2 times, most recently from 83e3247 to 22698af Compare September 1, 2023 22:38
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch from 22698af to 102e517 Compare September 1, 2023 22:52
@daphnegold daphnegold added the topic: infra Infrastructure related tickets label Sep 1, 2023
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch 4 times, most recently from 0688ce0 to 91e32e3 Compare September 2, 2023 03:18
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch from 91e32e3 to 341befb Compare September 2, 2023 03:30
@daphnegold daphnegold marked this pull request as ready for review September 2, 2023 03:39
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch from 2b1f84d to c07a116 Compare September 2, 2023 03:58
@daphnegold daphnegold force-pushed the daphnegold/issue-435-bar-the-gates branch 2 times, most recently from 1f65498 to 1ff7e81 Compare September 2, 2023 04:45
Copy link
Contributor

@SammySteiner SammySteiner left a 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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!
Screenshot 2023-09-06 at 9 14 20 AM

Copy link
Collaborator

@acouch acouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@daphnegold daphnegold merged commit bb39994 into main Sep 6, 2023
@daphnegold daphnegold deleted the daphnegold/issue-435-bar-the-gates branch September 6, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infra Infrastructure related tickets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Fix vulnerability checks
3 participants