Skip to content

Commit

Permalink
fix: trivy scan workflow doesn't fail if issues are identified
Browse files Browse the repository at this point in the history
  • Loading branch information
james-jdgtl committed Sep 24, 2024
1 parent 8cbd024 commit 3a397d9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/trivy_scan_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
steps:
# Need to checkout the repo to get the .trivyignore file
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner (table output)
id: trivy-vuln-scan
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.dockerfile-dir }}:latest
Expand All @@ -42,11 +43,12 @@ jobs:
severity: 'CRITICAL,HIGH'
#trivyignores: '${{ matrix.dockerfile-dir }}/.trivyignore'
timeout: 15m
continue-on-error: true

- name: Slack notification
id: slack
if: ${{ failure() }}
uses: slackapi/slack-github-action@v1.23.0
if: ${{ steps.trivy-vuln-scan.outcome }} == 'failure'
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: 'hmpps-sre-alerts-nonprod'
slack-message: "_Job:_ ${{ github.job }}\n_Status:_ ${{ job.status }}\n_Workflow:_ ${{ github.workflow }}\n_Repo:_ ${{ github.repository }}\n<https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View on github>\n"
Expand All @@ -70,7 +72,7 @@ jobs:
timeout: 15m

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: '${{ matrix.dockerfile-dir }}/trivy-results.sarif'

0 comments on commit 3a397d9

Please sign in to comment.