Skip to content

ci: stop re-downloading cosign/syft on guests that already have them - #572

Merged
smecsia merged 1 commit into
mainfrom
ci/reuse-preinstalled-attest-tools
Nov 8, 2026
Merged

smecsia merged 1 commit into
mainfrom
ci/reuse-preinstalled-attest-tools

Conversation

@smecsia

@smecsia smecsia commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

The bug

docker-build calls sign-and-attest without passing install-tools, so the input defaults to 'true' and the action runs sigstore/cosign-installer + anchore/sbom-action/download-syft unconditionally — on pcbuild guests whose rootfs already ships cosign v2.4.1 and syft v1.16.0 at exactly the pinned versions.

install-attest-tools is the action that consults that preinstall (exact version match on PATH; a mismatch falls through and downloads, so a wrong preinstall costs one download, never a wrong tool). sign-and-attest has no such guard.

Measured

Release run 41086127339, both jobs on pcbuild guests that had both tools:

job installs via result cost
Build sc for linux/amd64 install-attest-tools cosign preinstalled at v2.4.1: true; syft at v1.16.0: true 0.45 s
Docker build and push github-actions sign-and-attest downloads anyway 83.7 s

74 of those 83.7 s were a stall with no output before cosign-installer printed its first line — the fake-IP egress that the fleet design doc §5.1 records as intermittently hanging. The same path cost 7 min 11 s in run 39402578614 and hard-failed run 40007865716 attempt 2 (failed to install syft), discarding an entire release. Nothing surfaces it, because the consuming steps are continue-on-error.

Full sub-step breakdown of that 273 s Sign + attest step, from the raw job log:

Install cosign         83.7 s   <-- this PR
Install syft            1.0 s
Generate CycloneDX SBOM 162.1 s  <-- separate issue, see below
Cosign sign              8.4 s
Cosign attest            7.9 s
SLSA provenance          9.4 s

The change

Add an install-attest-tools step to docker-build — the same step build-platforms (push.yaml:294) and docker-finalize (push.yaml:1334) already have — and pass install-tools: 'false' to sign-and-attest.

Same fix in branch-preview.yaml, whose two docker-build legs are both heavy_go: true and so were paying the download twice on every preview build.

On the hosted legs (caddy, kubectl) neither binary is present, both guards miss, and this downloads exactly as before at ~4 s. Strict improvement on all four legs, not a fleet-only trade.

Expected effect

  • github-actions leg: Sign + attest 273 s → ~190 s
  • cloud-helpers-aws leg: 196 s → ~115 s
  • caddy / kubectl: unchanged (~41 s / ~37 s)
  • preview builds: −~83 s on each of two legs

Roughly −165 s per release and −165 s per preview build, plus removing two exposures per run to the egress path that has already discarded one release outright.

Risk

If the new install-attest-tools step flakes (it is continue-on-error, matching build-platforms), the sign/SBOM/attest sub-steps now fail their own version checks and the release gate reports it, rather than silently falling back to another minute of egress. That is the intended posture: a flake should be visible. The preview workflow has no gate, so there it surfaces through the existing warn-only aggregator.

No change to the attestation chain, the cosign identity, the pinned tool versions, or any runs-on.

Provenance

Item 2 of forge/provisioning/firecracker-buildvm/OWED-rootfs-attest-tools.md. The guest bake landed 2026-10-24 (actions#50 + bake-attest-tools-into-rootfs.sh) and was verified live, but api never consulted it — so the fleet has been carrying the tools for two weeks while docker-build downloaded them anyway. Re-verified in the base rootfs today: GitVersion: v2.4.1, Version: 1.16.0.

Not in this PR

The 162 s CycloneDX SBOM step is now the largest line item in Sign + attest — syft scan registry:… pulls the whole 1.36 GB image back down from Docker Hub through the same egress, immediately after pushing it. Worth its own change; measuring first.

`docker-build` called `sign-and-attest` without `install-tools`, so the input
defaulted to `true` and the action ran `sigstore/cosign-installer` +
`anchore/sbom-action/download-syft` unconditionally — on `pcbuild` guests whose
rootfs already ships cosign v2.4.1 and syft v1.16.0 at exactly the pinned
versions.

`install-attest-tools` is the action that consults that preinstall (exact
version match on PATH, falling through to a download on mismatch).
`sign-and-attest` has no such guard. Measured in release run 41086127339, both
jobs on guests that had both tools:

  build-platforms  install-attest-tools  "preinstalled: true"   0.45 s
  docker-build     sign-and-attest       downloads anyway       83.7 s

74 of those 83.7 s were a stall with no output, on the fake-IP egress the fleet
design doc §5.1 records as intermittently hanging. The same path cost 7m11s in
run 39402578614 and hard-failed run 40007865716 attempt 2 (`failed to install
syft`), discarding a release. Nothing surfaces it: the consuming steps are
continue-on-error.

So add an `install-attest-tools` step to `docker-build` — the same step
`build-platforms` and `docker-finalize` already have — and pass
`install-tools: 'false'` to `sign-and-attest`. Same fix in
`branch-preview.yaml`, whose two legs are both `heavy_go` and were paying it
twice per preview build.

On the hosted legs (caddy, kubectl) neither binary is present, both guards miss,
and this downloads as before at ~4 s — a strict improvement on all four legs,
not a fleet-only trade.

This is item 2 of forge's `provisioning/firecracker-buildvm/OWED-rootfs-attest-tools.md`:
the guest bake landed 2026-10-24 and was verified live, but `api` never
consulted it.

Signed-off-by: Ilya Sadykov <smecsia@gmail.com>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Semgrep Scan Results

Repository: api | Commit: ec3b22b

Check Status Details
⚠️ Semgrep Warning 11 warning(s), 15 total

Scanned at 2026-11-08 16:53 UTC

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Security Scan Results

Repository: api | Commit: ec3b22b

Check Status Details
✅ Secret Scan Pass No secrets detected
✅ Dependencies (Trivy) Pass 1 total (no critical/high)
✅ Dependencies (Grype) Pass 1 total (no critical/high)
📦 SBOM Generated 517 components (CycloneDX)

Scanned at 2026-11-08 16:54 UTC

@smecsia
smecsia merged commit ba92935 into main Nov 8, 2026
21 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.

3 participants