Skip to content

Commit 62065c3

Browse files
fix(ci): make grype scan non-fatal, add diagnostic enforcement step
The scan-action fail-build: true was preventing grype.json from being written when vulnerabilities were found, making it impossible to diagnose which CVEs were triggering the gate. Changed to fail-build: false + separate enforcement step that prints CVE details and exits 1, so the JSON artifact survives.
1 parent 172a1ab commit 62065c3

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,30 @@ jobs:
595595
uses: anchore/scan-action@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7.4.0
596596
with:
597597
image: engraphis:release
598-
fail-build: true
598+
fail-build: false
599599
severity-cutoff: high
600600
only-fixed: true
601601
output-format: json
602602
output-file: container-evidence/grype.json
603+
- name: Enforce grype severity gate
604+
shell: bash
605+
run: |
606+
set -euo pipefail
607+
python3 -c "
608+
import json, sys
609+
data = json.load(open('container-evidence/grype.json'))
610+
matches = [m for m in data.get('matches', [])
611+
if m.get('vulnerability', {}).get('severity', '') in ('High', 'Critical')]
612+
for m in matches:
613+
v = m['vulnerability']
614+
a = m.get('artifact', {})
615+
fix = v.get('fix', {})
616+
print(f\"{v['id']} {v['severity']} {a.get('name','?')} {a.get('version','?')} fix={fix.get('versions','none')} ns={v.get('namespace','?')}\")
617+
if matches:
618+
print(f'FAIL: {len(matches)} high/critical vulnerabilities found')
619+
sys.exit(1)
620+
print('PASS: no high/critical vulnerabilities')
621+
"
603622
- name: Verify production image OCR runtime
604623
run: >-
605624
docker run --rm --entrypoint sh engraphis:release -c

0 commit comments

Comments
 (0)