Skip to content

Commit 0321931

Browse files
committed
Fail trivy for high and critical
Signed-off-by: sandhi <sagarwal@progress.com>
1 parent 6a089ff commit 0321931

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

.github/workflows/ci-main-pull-request.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ on:
101101
required: false
102102
type: boolean
103103
default: true
104+
trivy-fail-on-high-critical:
105+
description: 'Fail pipeline if Trivy finds HIGH or CRITICAL vulnerabilities'
106+
required: false
107+
type: boolean
108+
default: true
104109

105110
build:
106111
description: 'CI Build (language-specific)'
@@ -715,6 +720,7 @@ jobs:
715720
needs: checkout
716721
with:
717722
version: ${{ inputs.version }}
723+
fail-on-high-critical: ${{ inputs.trivy-fail-on-high-critical }}
718724

719725
# run-srcclr:
720726
# if: ${{ inputs.perform-srcclr-scan == true }}

.github/workflows/trivy.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
required: false
1616
type: string
1717
default: '1.0.0'
18+
fail-on-high-critical:
19+
description: 'Fail the build if HIGH or CRITICAL vulnerabilities are found'
20+
required: false
21+
type: boolean
22+
default: true
1823

1924
jobs:
2025
trivy:
@@ -67,14 +72,16 @@ jobs:
6772
# name: trivy-report-${{ github.event.repository.name }}-${{ github.ref_name }}-${{ inputs.version }}-$(date +'%Y%m%d')-text
6873
path: trivy-report.txt
6974
retention-days: 30
70-
# - name: Fail build on High/Criticial Vulnerabilities
71-
# uses: aquasecurity/trivy-action@master
72-
# with:
73-
# scan-type: "fs"
74-
# format: table
75-
# scan-ref: .
76-
# severity: HIGH,CRITICAL
77-
# ignore-unfixed: true
78-
# exit-code: 1
79-
# # On a subsequent call to the action we know trivy is already installed so can skip this
80-
# skip-setup-trivy: true
75+
76+
- name: Fail build on High/Critical Vulnerabilities
77+
if: ${{ inputs.fail-on-high-critical }}
78+
uses: aquasecurity/trivy-action@master
79+
with:
80+
scan-type: "fs"
81+
format: table
82+
scan-ref: .
83+
severity: HIGH,CRITICAL
84+
ignore-unfixed: true
85+
exit-code: 1
86+
# On a subsequent call to the action we know trivy is already installed so can skip this
87+
skip-setup-trivy: true

0 commit comments

Comments
 (0)