fix: cache dir
CI / Test Merge SARIF Files (pull_request) Successful in 3s
CI / Test Get Images From Files (pull_request) Successful in 4s
CI / Test Setup DB (pull_request) Failing after 5s
CI / Test scan-fs (pull_request) Failing after 7s
CI / Test scan-image (pull_request) Failing after 17s
CI / Test scan-config (pull_request) Failing after 27s
CI / Test Merge SARIF Files (pull_request) Successful in 3s
CI / Test Get Images From Files (pull_request) Successful in 4s
CI / Test Setup DB (pull_request) Failing after 5s
CI / Test scan-fs (pull_request) Failing after 7s
CI / Test scan-image (pull_request) Failing after 17s
CI / Test scan-config (pull_request) Failing after 27s
This commit is contained in:
@@ -23,7 +23,7 @@ You pass a pullable **`image`** reference (e.g. `alpine:3.20` or a digest). Triv
|
||||
with:
|
||||
image: alpine:3.20
|
||||
cache-dir: ${{ steps.db.outputs.cache-dir }}
|
||||
output-dir: ${{ runner.temp }}/trivy-reports
|
||||
output-dir: ${{ github.workspace }}/trivy-reports
|
||||
output-file: image.sarif
|
||||
- name: Upload report
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -37,7 +37,7 @@ You pass a pullable **`image`** reference (e.g. `alpine:3.20` or a digest). Triv
|
||||
| Input | Description | Required | Default |
|
||||
| --------------- | --------------------------------------------------------------------------- | -------- | ------- |
|
||||
| `image` | Image reference to scan (pulled inside the container) | Yes | — |
|
||||
| `cache-dir` | Trivy cache directory (mounted read-only at `/cache`) | No | `${{ runner.temp }}/trivy` |
|
||||
| `cache-dir` | Trivy cache directory (mounted read-only at `/cache`) | No | `${{ github.workspace }}/.trivy-cache` |
|
||||
| `output-dir` | Host directory for the report (mounted read-write at `/out`) | Yes | — |
|
||||
| `output-file` | SARIF file name only (no `/`); created under `output-dir` | Yes | — |
|
||||
| `trivy-version` | Trivy Docker image (digest pin recommended) | No | Same pin as `setup-db` / see `action.yaml` |
|
||||
@@ -52,6 +52,7 @@ You pass a pullable **`image`** reference (e.g. `alpine:3.20` or a digest). Triv
|
||||
|
||||
## Notes
|
||||
|
||||
- **`output-dir`** is created with `mkdir -p` if missing; **`cache-dir`** must already exist.
|
||||
- Use **`cache-dir`** and **`output-dir`** under **`${{ github.workspace }}`** (or another path the Docker daemon can bind-mount) when the job runs in a container.
|
||||
- **`output-dir`** and **`cache-dir`** are created with `mkdir -p` if missing.
|
||||
- Local-only images (e.g. built on the host) are not supported unless they are available to the **inner** Docker pull (this action does not mount `docker.sock`).
|
||||
- The step still fails if Docker or the container exits non-zero before Trivy completes (e.g. mount or runtime errors).
|
||||
|
||||
@@ -12,7 +12,7 @@ inputs:
|
||||
cache-dir:
|
||||
description: "Host path to the Trivy cache directory (mounted read-only at /cache; use the same path as setup-db)"
|
||||
required: false
|
||||
default: "${{ runner.temp }}/trivy"
|
||||
default: "${{ github.workspace }}/.trivy-cache"
|
||||
output-dir:
|
||||
description: "Host directory where the report file is written (mounted read-write at /out)"
|
||||
required: true
|
||||
@@ -43,6 +43,7 @@ runs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
case "$OUTPUT_FILE" in */*|".."*) echo "FAIL: output-file must be a single file name (no path separators)"; exit 1 ;; esac
|
||||
mkdir -p "$CACHE_DIR_IN"
|
||||
cache_dir=$(realpath "$CACHE_DIR_IN")
|
||||
mkdir -p "$OUTPUT_DIR_IN"
|
||||
output_dir=$(realpath "$OUTPUT_DIR_IN")
|
||||
|
||||
Reference in New Issue
Block a user