Skip to content

feat(ci): add trivy scan #1

feat(ci): add trivy scan

feat(ci): add trivy scan #1

Workflow file for this run

name: "Trivy Scan"
on:
pull_request:
branches: [ master ]
permissions:
contents: read
env:
IMAGE_REPO: argoproj/argo-cd
jobs:
images:
name: Image Scan
runs-on: ubuntu-22.04
strategy:
matrix:
target: [ argocd ]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2a1a44ac4aa01993040736bd95bb470da1a38365 # v2.9.0
- name: Build image
run: |
tag=$(git describe --abbrev=0 --tags)
commit=$(git rev-parse HEAD)
if $(git tag --points-at ${commit}); then
echo "git_tag=`echo ${tag}-$(echo ${commit} | cut -c 1-7)`" >> $GITHUB_ENV
else
echo "git_tag=`echo ${tag}`" >> $GITHUB_ENV
fi
make image
- 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'