From c3256dc6bf49a2352dfe38b804d757683bb3ac22 Mon Sep 17 00:00:00 2001 From: Paul Nothaft Date: Wed, 13 May 2026 18:41:49 +0200 Subject: [PATCH] fix(ci): pin TRIVY_PLATFORM per matrix arch (post-#477 follow-up) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #477 moved Trivy from the merge-* job into the per-arch build-* matrix scanning by digest. The amd64 leg works; the arm64 leg crashes with: remote error: no child with platform linux/amd64 in index ghcr.io/.../@sha256: Root cause: docker/build-push-action wraps every push in an OCI index — the actual image manifest sits next to a SLSA provenance attestation manifest as siblings under the digest. Trivy's remote backend defaults to linux/amd64 when resolving an index, so: - amd64 leg → looks for amd64 child → finds the amd64 image → ok. - arm64 leg → looks for amd64 child → finds NO amd64 child (the only platform child is arm64) → fails. Fix: set TRIVY_PLATFORM = ${{ matrix.platform }} on each leg's Trivy step. Each scanner then asks for its own arch and finds it. SLSA provenance attestation stays attached to the per-arch images — a real win for supply-chain visibility we'd lose if we'd disabled provenance instead. amd64 was the only thing keeping CI partly green; this restores full green across both legs without touching the build artifact shape. --- .github/workflows/docker-build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 59fc5eb7..bf98c108 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -173,6 +173,17 @@ jobs: - name: Run Trivy vulnerability scanner (per-arch, by digest) if: steps.push-decision.outputs.push == 'true' uses: aquasecurity/trivy-action@v0.36.0 + env: + # docker/build-push-action wraps every push in an OCI index + # (carries the SLSA provenance attestation alongside the + # actual image). Trivy's remote backend defaults to + # linux/amd64 regardless of host arch when resolving an + # index, which makes the arm64 leg crash with "no child + # with platform linux/amd64". Telling Trivy which child to + # scan keeps the provenance attestation intact and fixes + # the resolver crash. Pin to matrix.platform so each leg + # scans its own arch. + TRIVY_PLATFORM: ${{ matrix.platform }} with: image-ref: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}@${{ steps.build.outputs.digest }} format: 'sarif' @@ -379,6 +390,12 @@ jobs: - name: Run Trivy vulnerability scanner (per-arch, by digest) if: steps.push-decision.outputs.push == 'true' uses: aquasecurity/trivy-action@v0.36.0 + env: + # See build-backend for the rationale — pin Trivy's platform + # to the matrix arch so its remote-index resolver picks the + # right child instead of defaulting to linux/amd64 and + # crashing on the arm64 leg. + TRIVY_PLATFORM: ${{ matrix.platform }} with: image-ref: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}@${{ steps.build.outputs.digest }} format: 'sarif'