Skip to content

Commit d484bbc

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 63b7fb4 commit d484bbc

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,11 +585,30 @@ jobs:
585585
uses: anchore/scan-action@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7.4.0
586586
with:
587587
image: engraphis:release
588-
fail-build: true
588+
fail-build: false
589589
severity-cutoff: high
590590
only-fixed: true
591591
output-format: json
592592
output-file: container-evidence/grype.json
593+
- name: Enforce grype severity gate
594+
shell: bash
595+
run: |
596+
set -euo pipefail
597+
python3 -c "
598+
import json, sys
599+
data = json.load(open('container-evidence/grype.json'))
600+
matches = [m for m in data.get('matches', [])
601+
if m.get('vulnerability', {}).get('severity', '') in ('High', 'Critical')]
602+
for m in matches:
603+
v = m['vulnerability']
604+
a = m.get('artifact', {})
605+
fix = v.get('fix', {})
606+
print(f\"{v['id']} {v['severity']} {a.get('name','?')} {a.get('version','?')} fix={fix.get('versions','none')} ns={v.get('namespace','?')}\")
607+
if matches:
608+
print(f'FAIL: {len(matches)} high/critical vulnerabilities found')
609+
sys.exit(1)
610+
print('PASS: no high/critical vulnerabilities')
611+
"
593612
- name: Verify production image OCR runtime
594613
run: >-
595614
docker run --rm --entrypoint sh engraphis:release -c
@@ -629,6 +648,7 @@ jobs:
629648
docker logs engraphis-release
630649
exit 1
631650
- name: Store whole-image evidence
651+
if: always()
632652
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
633653
with:
634654
name: production-image-evidence

0 commit comments

Comments
 (0)