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

This commit is contained in:
2026-04-10 19:07:45 +02:00
parent 6e5f62d4dd
commit adaa2a2b0f
9 changed files with 34 additions and 23 deletions
+6 -4
View File
@@ -4,6 +4,8 @@ A reusable Gitea Action that sets up the Trivy vulnerability database, restoring
The action runs Trivy inside **Docker** with a restricted container configuration so the Trivy runtime is isolated from the host while the database is downloaded into your cache directory.
The default **`cache-dir`** is under **`${{ github.workspace }}`** so the path is visible to the Docker daemon when jobs run inside a container (bind-mounting e.g. `/tmp/...` often fails because that path does not exist on the Docker host).
**Note:** This action only prepares the vulnerability database. If you run Trivy on the runner host for scans (for example `trivy fs .`), install Trivy separately (e.g. with a `setup-trivy` action or your own step).
## Usage
@@ -38,9 +40,9 @@ jobs:
## Inputs
| Input | Description | Required | Default |
| ---------------- | --------------------------------------------------------------------------- | -------- | ------- |
| `cache-dir` | Path to the Trivy cache directory | No | `${{ runner.temp }}/trivy` |
| `trivy-version` | Docker image reference for Trivy (digest pin recommended) | No | Pinned `ghcr.io/aquasecurity/trivy` image in `action.yaml` |
| Input | Description | Required | Default |
| --------------- | --------------------------------------------------------- | -------- | ---------------------------------------------------------- |
| `cache-dir` | Path to the Trivy cache directory | No | `${{ github.workspace }}/.trivy-cache` |
| `trivy-version` | Docker image reference for Trivy (digest pin recommended) | No | Pinned `ghcr.io/aquasecurity/trivy` image in `action.yaml` |
**`trivy-version` is optional.** If you omit it, the action uses the default image (version and digest) from `action.yaml`. Set it only when you need a different Trivy image or your own digest pin.
+5 -2
View File
@@ -7,9 +7,9 @@ branding:
inputs:
cache-dir:
description: "Path to the Trivy cache directory (default: ${{runner.temp}}/trivy)"
description: "Path to the Trivy cache directory (default: under the workspace so Docker bind mounts work on containerized runners)"
required: false
default: "${{ runner.temp }}/trivy"
default: "${{ github.workspace }}/.trivy-cache"
trivy-version:
description: "Trivy docker image version to use (full image reference including digest is recommended)"
required: false
@@ -23,6 +23,9 @@ outputs:
runs:
using: "composite"
steps:
- name: Ensure cache directory exists
shell: bash
run: mkdir -p "${{ inputs.cache-dir }}"
- id: current-date
shell: bash
run: |