Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trivy scan #2713

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Trivy Scan"

on:
pull_request:
branches: [ master ]

permissions:
contents: read

env:
IMAGE_REPO: fluidcloudnative
VERSION: v0.9.0

jobs:
images:
name: Image Scan
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: auto
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/fluid-cloudnative/fluid
strategy:
matrix:
target: [ dataset-controller, application-controller, alluxioruntime-controller, jindoruntime-controller, goosefsruntime-controller, juicefsruntime-controller, thinruntime-controller, eacruntime-controller ]
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/github.com/fluid-cloudnative/fluid

- name: Build image
run: |
echo "git_tag=`echo ${{ env.VERSION }}-$(git rev-parse --short HEAD || echo "HEAD")`" >> $GITHUB_ENV
make docker-build-all

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ env.IMAGE_REPO }}/${{ matrix.target }}:${{ env.git_tag }}'
format: 'sarif'
output: 'trivy-results.sarif'

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