File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ jobs:
275275 DOCKER_BUILD_SUMMARY : false
276276
277277 - name : Determine trivy scan severity levels
278- id : set_severity
278+ id : configure_trivy
279279 run : |
280280 if [[ "${{ github.event.inputs.scan_high_severity }}" == "false" ]] || \
281281 [[ "${{ vars.SCAN_HIGH_SEVERITY }}" == "false" ]] || \
@@ -284,6 +284,14 @@ jobs:
284284 else
285285 echo "severity=HIGH,CRITICAL" >> "$GITHUB_OUTPUT"
286286 fi
287+
288+ # If the TRIVY_CACHE_DIR is in the environment variables, we set it as output to be used in the trivy-action
289+ if [[ -n "$TRIVY_CACHE_DIR" ]]; then
290+ echo "cache_dir=$TRIVY_CACHE_DIR" >> "$GITHUB_OUTPUT"
291+ else
292+ echo "cache_dir=${{ github.workspace }}/.cache/trivy" >> "$GITHUB_OUTPUT"
293+ fi
294+
287295 - name : Run Trivy vulnerability scanner
288296 uses :
aquasecurity/[email protected] 289297 with :
@@ -294,9 +302,11 @@ jobs:
294302 exit-code : " 1"
295303 ignore-unfixed : false
296304 vuln-type : " os,library"
297- severity : ${{ steps.set_severity .outputs.severity }}
305+ severity : ${{ steps.configure_trivy .outputs.severity }}
298306 # The cache update takes quite long, so let's try to disable it for now: https://github.com/aquasecurity/trivy-action#cache
299307 cache : " false"
308+ # Explicitly set the cache directory to make it persistent between jobs
309+ cache-dir : ${{ steps.configure_trivy.outputs.cache_dir }}
300310 continue-on-error : false
301311
302312 - name : Push image
You can’t perform that action at this time.
0 commit comments