Skip to content

Commit c5885b4

Browse files
fix(ci): inline trivy binary install — drop broken trivy-action ref
GHA resolves all `uses:` action references at workflow LOAD time regardless of `if:` conditions. The pinned aquasecurity/trivy-action SHA transitively pulls aquasecurity/setup-trivy@v0.2.2 which no longer exists, causing EVERY consumer of this reusable workflow (webapp, webhook, agent-pi, release-pin-fetcher, AND the buildpacks path) to fail with "Unable to resolve action". Replace with a direct trivy binary install + invocation, mirroring the `pack` install pattern in the same workflow. No transitive action deps, sha256 verifiable, same idiom. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 23cb502 commit c5885b4

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/reusable-docker-build.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,24 @@ jobs:
217217
if-no-files-found: error
218218
retention-days: 90
219219

220-
# Report-only on first PR; flip exit-code to 1 after a clean baseline run on main.
221-
- name: CVE scan (Trivy)
220+
# Direct trivy binary install: GHA resolves `uses:` references at workflow load time
221+
# regardless of `if:` conditions, and aquasecurity/trivy-action's transitive setup-trivy
222+
# dependency breaks every consumer of this reusable workflow when it can't resolve.
223+
# Report-only; flip --exit-code 1 after main has a clean baseline.
224+
- name: Install + run Trivy (CVE scan, report-only)
222225
if: inputs.use-buildpacks
223-
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # 0.28.0
224-
with:
225-
image-ref: ${{ inputs.registry }}/${{ inputs.image-name }}:ci-${{ github.run_id }}-${{ steps.prep.outputs.platform_pair }}
226-
format: sarif
227-
output: ${{ runner.temp }}/trivy.sarif
228-
severity: CRITICAL,HIGH
229-
exit-code: 0
230-
ignore-unfixed: true
226+
env:
227+
TRIVY_VERSION: 0.58.2
228+
PER_ARCH_TAG: ${{ inputs.registry }}/${{ inputs.image-name }}:ci-${{ github.run_id }}-${{ steps.prep.outputs.platform_pair }}
229+
run: |
230+
set -euo pipefail
231+
ARCH=$([ "${{ runner.arch }}" = "ARM64" ] && echo "ARM64" || echo "64bit")
232+
curl -fsSL -o /tmp/trivy.tgz \
233+
"https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-${ARCH}.tar.gz"
234+
tar -xzf /tmp/trivy.tgz -C /usr/local/bin trivy
235+
trivy --version
236+
trivy image --severity CRITICAL,HIGH --ignore-unfixed --exit-code 0 \
237+
--format sarif --output "${{ runner.temp }}/trivy.sarif" "$PER_ARCH_TAG"
231238
232239
- name: Upload Trivy SARIF
233240
if: inputs.use-buildpacks

0 commit comments

Comments
 (0)