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

save grype db cache on updates to avoid using stale cache db #147

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions security-actions/sca/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ runs:
- name: Download Grype
uses: anchore/scan-action/[email protected]

# Check for any existing cache to reuse / update
- name: Cache Grype DB
id: cache_grype_db
# Check for any existing cache to reuse
- name: Restore Grype DB Cache
id: restore_grype_db
if: ${{ inputs.force_grype_db_update != 'true' }}
uses: actions/cache@v4
uses: actions/cache/restore@v4
env:
cache-name: cache_grype_db
with:
Expand All @@ -139,7 +139,6 @@ runs:

## Edgecase: Grype DB will never update if stale cache is found
- name: Grype DB Check Updates
#if: ${{ steps.cache_grype_db.outputs.cache-hit != 'true' }}
id: grype_db_check_updates
shell: bash
run: |
Expand Down Expand Up @@ -178,10 +177,10 @@ runs:
GRYPE_DB_UPDATE_DOWNLOAD_TIMEOUT: 600s # timeout for actual db download if needed
FORCE_GRYPE_DB_UPDATE: ${{ inputs.force_grype_db_update }}

- name: Cache Grype DB updates
- name: Update Cache / Save Grype DB updates
if: ${{ steps.grype_db_check_updates.outputs.GRYPE_DB_UPDATE_STATUS == 0 }}
id: cache_grype_db_updates
uses: actions/cache@v4
id: save_grype_db_cache_updates
uses: actions/cache/save@v4
env:
cache-name: cache_grype_db # Use generic cache key instead of unique keys for different refs since CVE DB doesn't change frequently
with:
Expand Down
Loading