Browse Source

ci: add Trivy CVE scan to container release workflow

pull/8819/head
Chris Lu 2 days ago
parent
commit
bc9b7e1cf7
  1. 37
      .github/workflows/container_latest.yml

37
.github/workflows/container_latest.yml

@ -26,6 +26,7 @@ on:
permissions: permissions:
contents: read contents: read
security-events: write
jobs: jobs:
setup: setup:
@ -149,9 +150,43 @@ jobs:
# Remove Go build cache # Remove Go build cache
sudo rm -rf /tmp/go-build* sudo rm -rf /tmp/go-build*
create-manifest:
trivy-scan:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [setup, build] needs: [setup, build]
strategy:
matrix:
variant: ${{ fromJSON(needs.setup.outputs.variants) }}
steps:
- name: Configure variant
id: config
run: |
if [ "${{ matrix.variant }}" == "large_disk" ]; then
echo "tag_suffix=_large_disk" >> $GITHUB_OUTPUT
else
echo "tag_suffix=" >> $GITHUB_OUTPUT
fi
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/chrislusf/seaweedfs:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.image_tag || 'latest' }}${{ steps.config.outputs.tag_suffix }}-amd64
format: sarif
output: trivy-results.sarif
severity: HIGH,CRITICAL
- name: Upload Trivy scan results to GitHub Security
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: trivy-results.sarif
create-manifest:
runs-on: ubuntu-latest
needs: [setup, build, trivy-scan]
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
strategy: strategy:
matrix: matrix:

Loading…
Cancel
Save