Skip to content

run-trivy

run-trivy #192

Workflow file for this run

name: run-trivy
on:
workflow_run:
workflows: [build]
types:
- completed
workflow_dispatch:
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db,aquasec/trivy-db,ghcr.io/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db,aquasec/trivy-java-db,ghcr.io/aquasecurity/trivy-java-db
jobs:
json_files:
name: Generate Build Environments
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
files: ${{ steps.json.outputs.files }}
steps:
- uses: actions/checkout@v4
- name: Find JSON files
id: json
run: |
pushd .config
echo "files=$(ls | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
popd
- run: |
echo "${{ steps.json.outputs.files }}"
build:
name: Run Trivy
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs: [json_files]
permissions:
contents: read
packages: read
id-token: write
security-events: write
strategy:
fail-fast: false
matrix:
image_name:
- automatos-server
environment: ${{ fromJSON(needs.json_files.outputs.files) }}
steps:
- name: Run Trivy vulnerability scanner against latest image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/${{ github.repository }}-${{ matrix.environment }}:latest'
format: 'sarif'
output: '${{ matrix.image_name }}-${{ matrix.environment }}.sarif'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
skip-dirs: 'sysroot'
scanners: 'vuln'
- name: Upload Trivy scan results to Github Security Tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: '${{ matrix.image_name }}-${{ matrix.environment }}.sarif'