Skip to content

Commit d1b2ca2

Browse files
committed
Fail the step if CVE is found (job is non-blocking)
1 parent 1873433 commit d1b2ca2

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

.github/workflows/kafka-connect-ci.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,8 @@ jobs:
114114
# a single scan avoids redundant work.
115115
#
116116
# Behaviour:
117-
# - Flag, don't block: the scan step uses exit-code 1 so it
118-
# "fails" when CVEs are found, but continue-on-error keeps
119-
# the overall job green. GitHub Actions shows the step with
120-
# an orange warning icon. This is the only mechanism Actions
121-
# provides for "visible but non-blocking" — there is no way
122-
# to show a red step while keeping the job green.
117+
# - If a CVE is found, the step will fail. However, since this job
118+
# is not a required one, it will not block merging.
123119
# - On push to main/release branches: results are uploaded as
124120
# SARIF to the GitHub Security tab for ongoing tracking.
125121
# - On PRs: SARIF upload is skipped because GitHub's Security
@@ -139,12 +135,9 @@ jobs:
139135
unzip kafka-connect/kafka-connect-runtime/build/distributions/iceberg-kafka-connect-runtime-*.zip \
140136
-d /tmp/kafka-connect-scan
141137
# Scan and output results as SARIF (for upload on push) while also
142-
# printing a human-readable summary to the CI log. exit-code 1 means
143-
# the step fails when CVEs are found; continue-on-error means the
144-
# job continues and the step shows as orange (not red) in the UI.
138+
# printing a human-readable summary to the CI log.
145139
- name: Run Trivy vulnerability scan
146140
if: matrix.jvm == 21
147-
continue-on-error: true
148141
uses: lhotari/sandboxed-trivy-action@f01374b6cc3bf7264ab238293e94f6db7ada6dd0 # v1.0.2
149142
with:
150143
scan-type: 'rootfs'
@@ -157,7 +150,7 @@ jobs:
157150
# Print human-readable results to the CI log so they're visible
158151
# without downloading the SARIF file.
159152
- name: Print Trivy scan results
160-
if: matrix.jvm == 21
153+
if: always() && matrix.jvm == 21
161154
run: |
162155
if [ -f trivy-results.sarif ]; then
163156
echo "## Trivy CVE Scan Results"
@@ -166,7 +159,7 @@ jobs:
166159
echo "No SARIF file found — scan may have failed to install."
167160
fi
168161
- name: Upload Trivy results to GitHub Security tab
169-
if: matrix.jvm == 21 && github.event_name == 'push'
162+
if: always() && matrix.jvm == 21 && github.event_name == 'push'
170163
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
171164
with:
172165
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)