Skip to content

Commit

Permalink
Merge pull request #83 from eclipse-tractusx/ci/setup-trivy-scans
Browse files Browse the repository at this point in the history
ci: configure trivy scans
  • Loading branch information
tom-rm-meyer-ISST authored Nov 15, 2023
2 parents efe9aa5 + 1f5ad64 commit 3c34ecd
Showing 1 changed file with 34 additions and 26 deletions.
60 changes: 34 additions & 26 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,56 @@
# SPDX-License-Identifier: Apache-2.0
#

name: "Trivy"
name: "Run Trivy scan and upload SARIF"

on:
push:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
pull_request:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
# Trigger manually
schedule:
- cron: "0 0 * * *" # Once a day

jobs:
analyze:
analyze-frontend:
name: Analyze frontend
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
# Pull image from Docker Hub and run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: "tractusx/app-puris-frontend:main"
format: "sarif"
output: "trivy-results-1.sarif"
vuln-type: "os,library"

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "trivy-results-1.sarif"

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
analyze-backend:
name: Analyze backend
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
# Pull image from Docker Hub and run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: "config"
exit-code: "1"
hide-progress: false
image-ref: "tractusx/app-puris-backend:main"
format: "sarif"
output: "trivy-results1.sarif"
severity: "CRITICAL,HIGH"
output: "trivy-results-2.sarif"
vuln-type: "os,library"

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: "trivy-results1.sarif"
sarif_file: "trivy-results-2.sarif"

0 comments on commit 3c34ecd

Please sign in to comment.