Skip to content

ci: scan the release-candidate image before the tag, not after - #392

Merged
0xmanhnv merged 1 commit into
developfrom
ci/scan-release-candidate-image
Aug 2, 2026
Merged

ci: scan the release-candidate image before the tag, not after#392
0xmanhnv merged 1 commit into
developfrom
ci/scan-release-candidate-image

Conversation

@0xmanhnv

@0xmanhnv 0xmanhnv commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

The gap

docker-scan:
  if: github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main')

So the container image is scanned on a weekly schedule and on push to main
never on the PR that puts the code there.

docker-publish.yml triggers on push: tags: v*, and the tag goes on main
after the release merge. So the sequence today is:

  1. release PR merges into main — no image scan
  2. v0.4.0 tag pushed — image built and published
  3. push-to-main scan runs — after customers can already pull it

For a security product, scanning the artifact after shipping it is the wrong
order.

The change

Run it for pull requests whose base is main as well. The job builds the image
itself (push: false, load: true) rather than pulling a published one, so there
was never anything stopping it running earlier — it just was not asked to.

Costs one extra image build per release PR. Release PRs happen a handful of
times a year.

Why now

Found while clearing the red checks on the v0.4.0 release PRs. On ui the same
condition also produced a failing Trivy check —
1 configuration present on refs/heads/main was not found — because code
scanning compares a PR against the configurations present on its base branch,
and main expects an analysis from this job.

api is not red today, but only because main has no recorded analysis
from this job to compare against. The scanning gap is identical; the symptom
just has not surfaced here. Fixed in ui as part of ui#347.

docker-scan was gated on `schedule || push to main`, so it never ran on a PR
into main. docker-publish.yml triggers on the `v*` tag, which is pushed after
that merge — so the first time the container image gets scanned is after
customers can already pull it. For a security product that is the wrong order.

The job builds the image itself rather than pulling a published one, so nothing
prevented it running while the release is still reviewable; it just was not
asked to. Costs one extra image build per release PR, a handful per year.

Same change as ui#347, where the gap was also producing a red Trivy check
("1 configuration present on refs/heads/main was not found") because code
scanning compares a PR against the configurations on its base branch. api is
not red today only because main has no recorded analysis from this job to
compare against — the scanning gap is identical.
@0xmanhnv
0xmanhnv merged commit b990aa3 into develop Aug 2, 2026
16 checks passed
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.

1 participant