Files
ci-actions/README.md
T
tthandClaude Opus 5.5 7fae1fa2f6 trivy-gate: fs scans of lockfiles, checksum-verified binary when no Docker
dtrack-sbom converts with the same runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:54:03 +01:00

73 lines
2.3 KiB
Markdown

# ci-actions
Shared composite actions for Gitea Actions.
## trivy-gate
Scans a pushed image with Trivy (vulnerabilities + secrets) and fails when it
finds a **fixable** vulnerability of the given severities (default
`HIGH,CRITICAL`) or an embedded secret. Vulnerabilities without a fix are
reported but never block - otherwise a deploy could be stuck forever.
Intended order in a pipeline:
1. build and push only the immutable tag (`sha-…`)
2. `trivy-gate` on that tag
3. move the floating tag (`latest`, `stable-<arch>`) and deploy
```yaml
- id: trivy
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v1
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.build.outputs.sha }}
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
platform: linux/arm64 # single-platform non-amd64 images only
mode: block # or warn
skip: ${{ inputs.skip_trivy || 'false' }}
```
Source trees (apps that ship no image, e.g. an APK): `scan-type: fs` scans
the git-tracked files plus lockfiles generated in the job (also gitignored
ones like Flutter's `pubspec.lock`), so run it after the dependency fetch:
```yaml
- uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v1.1
with:
scan-type: fs
```
Jobs without a Docker daemon (a `container:` image such as Flutter) fall
back to the pinned Trivy release binary, verified by SHA-256 (`runtime:
auto`); `jq` is installed with apt when missing.
Accepted risks go to `.trivyignore.yaml` in the calling repo, each with a
statement and an expiry, so they come back on their own:
```yaml
vulnerabilities:
- id: CVE-2026-12345
statement: not reachable, the affected feature is disabled
expired_at: 2026-12-31
```
The vulnerability DB lives in the Docker named volume `trivy-cache` on the
runner host (refreshed under an exclusive lock, scans read it read-only under
a shared lock, so parallel matrix jobs are fine).
## dtrack-sbom
Converts the `trivy-gate` report to CycloneDX and uploads it to
Dependency-Track. Never fails the job.
```yaml
- uses: https://git.rfa.cz/tth-pub/ci-actions/dtrack-sbom@v1
with:
report: ${{ steps.trivy.outputs.report }}
url: ${{ vars.DTRACK_URL }}
api-key: ${{ secrets.DTRACK_API_KEY }}
ca-pem: ${{ vars.RFA_CA_PEM }}
project: my-image
version: latest
```