Skip to content

fix(docker-build): tag and sign only after the Trivy scan passes - #91

Merged
nkg merged 1 commit into
mainfrom
fix/docker-build-tag-after-scan
Oct 2, 2026
Merged

nkg merged 1 commit into
mainfrom
fix/docker-build-tag-after-scan

Conversation

@nkg

@nkg nkg commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Fixes #87.

Problem

docker-build.yml pushed the image with all its tags, then ran the failing Trivy scan. A red gate still left the rejected image live under latest and the branch tag.

Change

  • Build pushes by digest only (push-by-digest=true, no tags).
  • Trivy scans that digest.
  • New Tag the scanned digest step applies the metadata-action tags with docker buildx imagetools create, and asserts each tag resolves to the scanned digest.
  • Cosign now runs after the scan, so only a passing image gets signed.
  • SARIF and SBOM steps are unchanged.

No input or output changes. push: false still builds without publishing. Callers with run-trivy-scan: false get the same tags as before.

Verification

  • actionlint and yamllint pass locally.
  • Not exercised at runtime. self-test.yml has no docker-build job and there is no local Docker. Before cutting a release, point one consumer (for example HordiaLabs/extractor-llm) at this branch and confirm the tags land and cosign verify still passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C5bjKagyEioaHuJicZbyvm

…asses

The build pushed with its tags and then gated, so a failed scan had
already moved latest. Push by digest, scan the digest, then apply the
tags with imagetools create; cosign moves below the scan as well.

Fixes #87

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5bjKagyEioaHuJicZbyvm
@nkg
nkg merged commit 459f46d into main Oct 2, 2026
12 checks passed
@nkg
nkg deleted the fix/docker-build-tag-after-scan branch October 2, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker-build: the image is pushed (and tagged latest) before Trivy scans it

1 participant