Trivy Scan #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trivy Scan | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
trivy-scan: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout submodule | |
uses: Mushus/[email protected] | |
with: | |
basePath: # optional, default is . | |
submodulePath: libvgpu | |
- name: Get branch name | |
uses: nelonoel/[email protected] | |
- name: Docker Login | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_TOKEN }} | |
password: ${{ secrets.DOCKERHUB_PASSWD }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Generating image tag | |
id: runtime-tag | |
run: | | |
echo tag="$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- run: make tidy | |
- run: SHORT_VERSION=${{ steps.runtime-tag.outputs.tag }} bash ./hack/build.sh | |
- name: Run Trivy vulnerability scanner (table output) | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: "projecthami/hami:${{ steps.runtime-tag.outputs.tag }}" | |
format: "table" | |
ignore-unfixed: true | |
severity: "HIGH,CRITICAL" | |
vuln-type: "os,library" | |
trivyignores: .trivyignore | |
- name: Run Trivy vulnerability scanner (SARIF) | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: "projecthami/hami:${{ steps.runtime-tag.outputs.tag }}" | |
format: "sarif" | |
output: "trivy-results.sarif" | |
ignore-unfixed: true | |
vuln-type: "os,library" | |
trivyignores: .trivyignore | |
if: always() && github.repository == 'Project-HAMi/HAMi' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: "trivy-results.sarif" | |
if: always() && github.repository == 'Project-HAMi/HAMi' |