Skip to content

Commit

Permalink
Update GitHub workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
ropable committed Oct 3, 2023
1 parent 2f9068a commit c39bacb
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/image-build-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ jobs:
packages: write
security-events: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Checkout repository
uses: actions/checkout@v3
id: checkout-repo
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ${{ env.REGISTRY }}
Expand All @@ -41,22 +46,32 @@ jobs:
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Run Trivy vuln scanner on Docker image
scan:
name: Trivy scan
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: read
security-events: write
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
ignore-unfixed: true
scan-type: image
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'HIGH,CRITICAL'
format: template
template: '@/contrib/sarif.tpl'
output: trivy-results.sarif
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
sarif_file: trivy-results.sarif

0 comments on commit c39bacb

Please sign in to comment.