Skip to content

Commit b8bc595

Browse files
committed
fix: pull multiplatform image for local scanning
Multiplatform images built with 'docker buildx build --push' are pushed to the registry but not loaded into the local Docker daemon. Scanning tools (Dockle, Syft, Grype) require the image to be available locally. Add explicit pull step after build to make image available for scanning. Fixes grype-results.sarif not found error in PR #1166 Signed-off-by: Manav Gupta <manavg@gmail.com>
1 parent 616a52e commit b8bc595

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/docker-image.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,15 @@ jobs:
127127
. # build context is mandatory
128128
129129
# -------------------------------------------------------------
130-
# 5️⃣ Image lint (Dockle CLI → SARIF)
130+
# 5️⃣ Pull image for scanning (multiplatform builds don't load locally)
131+
# -------------------------------------------------------------
132+
- name: 📥 Pull image for local scanning
133+
run: |
134+
echo "📥 Pulling image for scanning (multiplatform images not available locally after --push)..."
135+
docker pull $IMAGE_NAME:latest
136+
137+
# -------------------------------------------------------------
138+
# 6️⃣ Image lint (Dockle CLI → SARIF)
131139
# -------------------------------------------------------------
132140
- name: 🔍 Image lint (Dockle)
133141
id: dockle
@@ -149,7 +157,7 @@ jobs:
149157
sarif_file: dockle-results.sarif
150158

151159
# -------------------------------------------------------------
152-
# 6️⃣ Generate SPDX SBOM with Syft
160+
# 7️⃣ Generate SPDX SBOM with Syft
153161
# -------------------------------------------------------------
154162
- name: 📄 Generate SBOM (Syft)
155163
uses: anchore/sbom-action@v0.20.5
@@ -158,7 +166,7 @@ jobs:
158166
output-file: sbom.spdx.json
159167

160168
# -------------------------------------------------------------
161-
# 7️⃣ Trivy, Grype CVE scan → SARIF
169+
# 8️⃣ Trivy, Grype CVE scan → SARIF
162170
# -------------------------------------------------------------
163171
- name: 🛡️ Trivy vulnerability scan
164172
if: env.TRIVY_ENABLED == 'true'
@@ -193,7 +201,7 @@ jobs:
193201
sarif_file: grype-results.sarif
194202

195203
# -------------------------------------------------------------
196-
# 8️⃣ Key-less Cosign sign + attest (latest **and** timestamp)
204+
# 9️⃣ Key-less Cosign sign + attest (latest **and** timestamp)
197205
# -------------------------------------------------------------
198206
- name: 📥 Install Cosign
199207
if: github.ref == 'refs/heads/main'
@@ -216,7 +224,7 @@ jobs:
216224
done
217225
218226
# -------------------------------------------------------------
219-
# 9️⃣ Single gate - fail job on any scanner error
227+
# 🔟 Single gate - fail job on any scanner error
220228
# -------------------------------------------------------------
221229
- name: ⛔ Enforce lint & vuln gates
222230
if: |

0 commit comments

Comments
 (0)