CI: Replace inline Grype scan with shared action - #29
Conversation
Swap the inline Grype install/scan/report shell carried by the Maven and Gradle build workflows for the lfreleng-actions/grype-scan-action composite action (v0.0.1), pinned to its commit SHA. The action reproduces the previous behaviour: it scans the CycloneDX JSON SBOM, writes sarif/json/table reports, uploads them under the same grype-scan-results artefact name, renders a step summary and honours the existing grype_fail_on and grype_permit_fail inputs (the latter still falling back to the NO_BLOCK_AUDIT_FAIL repository variable). It also supports maintainer-approved CVE bypass issues, so the jobs hosting the scan now request issues: read and pass GITHUB_TOKEN for the lookup. A called workflow cannot request permissions the caller withholds, so the self-test callers and the example caller templates all grant issues: read alongside their existing permissions. Centralising the logic means a fix or an improvement now lands once in the action rather than in every workflow family. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
There was a problem hiding this comment.
Pull request overview
Replaces duplicated inline Grype scanning logic with the pinned shared action and enables CVE bypass issue access.
Changes:
- Adopts
grype-scan-actionfor Maven and Gradle. - Grants
issues: readto reusable workflow callers. - Preserves report and artifact configuration via action defaults.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/maven-build-test.yaml |
Migrates Maven Grype scanning. |
.github/workflows/gradle-build-test.yaml |
Migrates Gradle Grype scanning. |
.github/workflows/testing.yaml |
Grants self-test callers issue access. |
examples/maven/build-test/github.yaml |
Updates Maven GitHub caller permissions. |
examples/maven/build-test/gerrit.yaml |
Updates Maven Gerrit caller permissions. |
examples/gradle/build-test/github.yaml |
Updates Gradle GitHub caller permissions. |
examples/gradle/build-test/gerrit.yaml |
Updates Gradle Gerrit caller permissions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Functional validationThis repo's self-test is Run: modeseven-lfreleng-actions/java-workflows 32873609700 (branch The composite action executed end to end in both lanes:
The Grype jobs go red, and that is the gate working as intended: the placeholder fixtures are old releases carrying real CVEs ( Confirmed against a pre-migration baselineTo be sure this was not a regression I ran the same self-test on upstream The two runs disagree on the Gradle lane (green upstream, red on the branch), and that turned out to be worth chasing: both lanes upload and download an artefact literally named That is a pre-existing race, unrelated to this PR: the diff here does not touch the SBOM artefact names or the upload/download steps, only the scan steps. Filed separately as #30 rather than expanded into this change. |
Replaces the inline Grype install/scan/report shell carried by the Maven and Gradle build workflows with the shared
lfreleng-actions/grype-scan-actioncomposite action (v0.0.1), pinned to its commit SHA.This is the same migration already merged in
python-workflows(lfreleng-actions/python-workflows#65), which has been running cleanly against the Python projects hosted here.What changed
Both
maven-build-test.yamlandgradle-build-test.yamllose four steps from theirgrypejob —Install Grype, the inline scan script,Upload Grype scan resultsandGrype summary— in favour of a singleuses:step.Behaviour is preserved:
sbomjob uploadssbom-cyclonedx.*(both JSON and XML); the scan targets the JSON document only, as before.grype-scan-resultsartefact name, with the same 90-day retention (both are the action's defaults).grype_fail_onandgrype_permit_failbehave as before, the latter still falling back to theNO_BLOCK_AUDIT_FAILrepository variable.Permissions
The action additionally supports maintainer-approved CVE bypass issues, which requires reading issues. The
grypejob therefore requestsissues: readand passesGITHUB_TOKEN.A called workflow cannot request a permission its caller withholds, so the self-test callers and the example caller templates all grant
issues: readalongside their existing permissions. The README carries no caller snippet with apermissions:block, so it needed no change.api.github.com:443is already present in the shared egress allow-list, so the bypass lookup works underharden-runnerblock mode. Lookup failures leave the bypass list empty, so the gate fails closed either way.Why
Centralising the logic means a fix or an improvement lands once in the action rather than in every workflow family. Net effect here is 204 lines of duplicated shell removed.
Validation
prek run --all-files— all hooks passzizmor --persona auditor .github/workflows/— no findingsaislop ci --changes— 0 errors, 0 warnings