ci(phase-3): migrate security.yml::trivy to extended container reusable#13
Merged
Merged
Conversation
Replaces the inline Trivy + SARIF-upload steps with a call to
netresearch/.github/.github/workflows/security-container.yml@main
(Phase 2.5 extended the reusable with tolerate-pull-failure for
exactly this caller).
The matrix axis (latest, rolling), workflow_run conclusion gate, and
permissions stay on the caller job. tolerate-pull-failure: true on
the rolling cell replaces the previous job-level
`continue-on-error: ${{ matrix.tag == 'rolling' }}` — GitHub forbids
that key on reusable-caller jobs, so the reusable handles the
missing-rolling-image case via a pre-flight `docker manifest inspect`
probe and skips the Trivy + SARIF-upload steps when the manifest is
unavailable (without swallowing legitimate finding-based failures).
Defaults of the reusable match the previous inline values
(exit-code: 0, ignore-unfixed, vuln-type os,library, severity
HIGH,CRITICAL, limit-severities-for-sarif), so behaviour is
preserved.
osv-scanner stays inline: the composer.lock extraction (docker
create + docker cp from /var/www/html) is snipe-it-specific and
doesn't generalise into the container reusable surface.
build.yml stays inline for now: see PR body for the two upstream
gaps that need fixing first (tolerate-build-failure input + a path
for caller-resolved ref / caller-computed tag fan-out without a
2-job matrix dance).
security.yml: 135 → 118 lines (trivy block 50 → 26).
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
There was a problem hiding this comment.
Pull request overview
Migrates the trivy job in this repository’s security workflow from inline steps to the shared netresearch/.github reusable container security workflow, keeping the existing “rolling image may not exist” behavior while satisfying GitHub’s restrictions for reusable-workflow caller jobs.
Changes:
- Replaced the inline
trivyscan + SARIF upload steps with a call tonetresearch/.github/.github/workflows/security-container.yml@main. - Implemented the previous “rolling tag may be missing” tolerance via
tolerate-pull-failure: ${{ matrix.tag == 'rolling' }}rather than job-levelcontinue-on-error. - Updated workflow comments to reflect the new delegation and rationale.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Phase 3 of the container-CI consolidation
Migrates
.github/workflows/security.yml'strivyjob to the Phase-2.5-extendedsecurity-container.yml@mainreusable innetresearch/.github.What migrated
security.yml::trivy— now callsnetresearch/.github/.github/workflows/security-container.yml@mainwithtolerate-pull-failure: ${{ matrix.tag == 'rolling' }}. The reusable's pre-flightdocker manifest inspectprobe replaces the previous job-levelcontinue-on-error: ${{ matrix.tag == 'rolling' }}(which GitHub forbids on reusable-caller jobs anyway — actionlint rejects it). The behavioural contract is preserved: a missing rolling image short-circuits the Trivy + SARIF-upload steps and exits the job green, while legitimate Trivy finding-based failures (callerexit-code: '1') still propagate normally because the reusable does NOT slap a broadcontinue-on-erroron Trivy itself.Defaults of the reusable line up 1:1 with the previous inline values:
exit-code: 0,ignore-unfixed: true,vuln-type: os,library,severity: HIGH,CRITICAL,limit-severities-for-sarif: true,scanners: vuln. No behavioural change beyond replacing thecontinue-on-errormechanism. SARIF category remainstrivy-${{ matrix.tag }}so the GitHub Security tab grouping is unchanged.Line counts:
security.yml135 → 118 (-17). Thetrivyjob block itself shrank from ~50 lines (steps: checkout + trivy-action + upload-sarif) to ~26 (matrix +with:block + permissions).What stays inline (and why)
security.yml::osv-scanner— Per the explicit task constraint #11: composer.lock extraction (docker pull+docker create+docker cp /var/www/html/composer.lock) is Snipe-IT-specific (path + lock-file location are not generalisable) and the osv-scanner action itself doesn't fit the container reusable's surface. The job retains its owncontinue-on-error: ${{ matrix.tag == 'rolling' }}since it is NOT a reusable-caller job and the keyword is legal at the regular-job level.build.yml— left inline as a follow-up upstream item. Honest report: two independent blockers prevent a clean migration tobuild-container.yml@mainright now.continue-on-error: ${{ matrix.composer == 'rolling' }}is forbidden on reusable-caller jobs (same GitHub restriction we just worked around for trivy). The build-container reusable does not currently expose atolerate-build-failureknob analogous totolerate-pull-failure— and unlike the security side, rolling-build failures aren't a manifest-not-found case the reusable can pre-flight cheaply; they're caused bycomposer auditblocking inside the docker build, which is a build-time failure mode that needs different plumbing.uses:. A reusable-caller job allows onlyname,uses,with,secrets,needs,if,permissions,concurrency,strategy— no inlinesteps:. The currentbuild.ymldoes meaningful work in steps before the metadata + build calls: reads.snipe-it-version(tag track), callsgh api repos/grokability/snipe-it/commits/{master,develop}(branch tracks), computes the{version, major, major_minor, date_tag, build_date}outputs, then computes a custom tag-fan-out list (8.5.0 / 8.5 / 8 / latest, with-rollingsuffixes when applicable). Refactoring this into a separatecomputematrix job whose outputs feed thebuildmatrix job vianeeds:+outputs:+fromJSONgymnastics would make the workflow MORE complex than the inline version, not less. Task description explicitly authorises leaving build.yml inline in this case.Proposed follow-up upstream PR on
netresearch/.github(does not block this PR): add atolerate-build-failure: boolinput tobuild-container.ymlthat wraps theBuild and pushstep in equivalent semantics (e.g.continue-on-error: trueon the build step + asteps.build.outcome != 'failure'gate on attest/sign). Once that's available, thebuild.ymlmigration can be revisited — though the second blocker (caller-side ref resolution as steps) will likely keep build.yml inline regardless. Themetadata-tags+metadata-labels+build-args+cache-scope+target+provenance+sbominputs added in Phase 2.5 are all the reusable-side surface this caller would consume, and they're complete.Hard-constraint compliance
uses: netresearch/.github/.github/workflows/security-container.yml@main— pinned to@main, no SHA pin on the org's own reusable (rule #3). All third-party action SHAs preserved verbatim (no new third-party action references introduced; we deleted some). SPDX header retained with "Netresearch DTT GmbH". Conventional-commit prefix on the commit. Signed + signed-off commit matchinggit config user.name/user.email.Verification
actionlint .github/workflows/*.yml— clean across all workflows.yamllintwith the snipe-it project config — only pre-existing comment-spacing warnings on SHA-pin comments (no new findings; net warnings down from 5 to 2 since 3 inline action references were removed).tail -c 2 .github/workflows/security.yml | xxd -p→6b0a(single trailing newline, no double).git show --stat HEADconfirms only.github/workflows/security.ymlchanged.CI run will exercise the new caller against the published
:latest(present) and:rolling(currently failing builds → manifest absent → pre-flight skip path).