Skip to content

Commit

Permalink
feat(github): test scanning vulnerabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Nov 27, 2024
1 parent 131b12b commit 8bd4365
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/vulnerabilities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Scan Vulnerabilities

on:
schedule:
- cron: '30 9 * * 1'

permissions:
contents: read

jobs:
scan-docker-images:
permissions:
actions: read
contents: read
security-events: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
tags: true

- name: Run Trivy (client:dev)
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/diracgrid/diracx/client:dev"
format: "sarif"
output: "client-dev-vulnerability-report.sarif"

- name: Upload SARIF to GitHub Security (client:dev)
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "client-dev-vulnerability-report.sarif"
category: "client-dev"

- name: Run Trivy (services:dev)
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/diracgrid/diracx/services:dev"
format: "sarif"
output: "services-dev-vulnerability-report.sarif"
skip-setup-trivy: true

- name: Upload SARIF to GitHub Security (services:dev)
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "services-dev-vulnerability-report.sarif"
category: "services-dev"

- name: Get Latest Release Tag
id: get-latest-tag
run: |
tag=$(git rev-list --tags --max-count=1 --date-order)
if [ -z "$tag" ]; then
echo "latest_tag=" >> $GITHUB_OUTPUT
else
latest_tag=$(git describe --tags "$tag")
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT
fi
- name: Run Trivy (client:release)
if: ${{ steps.get-latest-tag.outputs.latest_tag != '' }}
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/diracgrid/diracx/client:${{ steps.get-latest-tag.outputs.latest_tag }}"
format: "sarif"
output: "client-rel-vulnerability-report.sarif"
skip-setup-trivy: true

- name: Upload SARIF to GitHub Security (client:rel)
if: ${{ steps.get-latest-tag.outputs.latest_tag != '' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "client-rel-vulnerability-report.sarif"
category: "client-rel"

- name: Run Trivy (services:release)
if: ${{ steps.get-latest-tag.outputs.latest_tag != '' }}
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/diracgrid/diracx/services:${{ steps.get-latest-tag.outputs.latest_tag }}"
format: "sarif"
output: "services-rel-vulnerability-report.sarif"
skip-setup-trivy: true

- name: Upload SARIF to GitHub Security (services:rel)
if: ${{ steps.get-latest-tag.outputs.latest_tag != '' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "services-rel-vulnerability-report.sarif"
category: "services-rel"

0 comments on commit 8bd4365

Please sign in to comment.