Skip to content

Trivy Scan

Trivy Scan #864

Workflow file for this run

name: Trivy Scan
on:
workflow_dispatch:
schedule:
- cron: "17 17 * * *"
permissions:
contents: read
jobs:
build:
permissions:
contents: read
security-events: write
name: Scan
runs-on: "ubuntu-latest"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Get repository name
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f
- name: Install devbox deps
run: devbox install
- name: Prepare build
run: devbox run -- make build
- name: Build container
env:
KO_DOCKER_REPO: ko.local
PLATFORMS: linux/amd64,linux/arm64,linux/arm
run: |
export SOURCE_DATE_EPOCH=$(date +%s)
devbox run -- ko build -B -t ${{ github.sha }} --platform=$PLATFORMS .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.29.0
env:
TRIVY_DB_REPOSITORY: "ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db"
with:
image-ref: "ko.local/${{ env.REPOSITORY_NAME }}:${{ github.sha }}"
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"