Skip to content

devcloud: a package layer of its own and a 6 s image export (board #116) - #340

Merged
SSFSKIM merged 5 commits into
mainfrom
devcloud-image-layers
Oct 22, 2026
Merged

SSFSKIM merged 5 commits into
mainfrom
devcloud-image-layers

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Board #116: cache-friendly devcloud image layers and a faster image check. Full account: docs/doperpowers/plans/2026-10-22-devcloud-image-layers-report.md.

What changed

  • Package layer (cut 1). The packages moved out of setup.sh into a new devcloud/image/packages.sh, which takes no input. setup.sh runs it after its input checks, so a VM bake and adopt still run one recipe. The Dockerfile runs packages.sh as its own RUN: it mounts that one file and comes before the build ARGs, so the layer is keyed on packages.sh alone. The rest of setup.sh runs after it (DEVCLOUD_PACKAGES=installed). devcloud is now 0.8.1, since the recipe changed.
  • Image check (cut 2). I profiled before parallelizing. The ticket's 96 s was not the scan, it was the export: streaming the root filesystem out through docker run's attach took 82 s, against 9.6 s for the bun scan and 4.4 s for dpkg. check_image.export now runs the same tar inside a container of the image, onto a bind mount at a random path, then chowns the copy back to the caller. That takes 6 s, and the file listing is the same as the old export's. I did not shard the scan: 4 shards would save about 5 s, at the cost of a second way for a fail-closed check to read less than the image holds.
  • Rebalance. PARTS is now image = image + one-shot, host = host + projects, systemd = systemd.

Validation Evidence

Before and after (CI runs on 4-vCPU runners; "before" is #336's PR run 39704697659, "after" is run 39718389395 on ed5e6fd):

gate job before → after integration before → after
devcloud-unit 1m24s → 1m29s –
devcloud-image 4m21s → 3m30s 96 s → 65 s (image_is_clean alone: 96 s → 16 s)
devcloud-host 4m50s → 3m55s 108 s → 87 s
devcloud-systemd 3m39s → 3m08s 88 s → 65 s
set wall time 4m50s → 3m55s slowest part 108 s → 87 s

The unsharded run (a throwaway devcloud-all gate, same run) went from 8m38s to 7m33s, with integration 289 s → 215 s.

Profile (run 39716683368, instrumented scanner on a throwaway commit): export 82.3 s; scan 9.6 s (pattern detection 4.3 s, known-value search 3.0 s, reads 0.9 s, walk 0.4 s); dpkg 4.4 s. Export methods compared in run 39717304822:

export method time listing
docker run tar | tar -x (the old one) 83.0 s –
docker export 19.8 s differs: placeholder /etc/hosts and the like
in-container tar onto a bind mount 5.8 s 71,934 entries, equal to the old one

The PR's own run (39719781323 on 2ed14dc, all green): devcloud-unit 1m19s; devcloud-image 4m01s (build 146 s, integration 70 s, image_is_clean 16 s); devcloud-host 4m05s (build 138 s, integration 87 s); devcloud-systemd 3m12s (build 115 s, integration 67 s). The set's wall time was 4m05s, against 4m50s for #336's PR run. Build variance between runners (115–146 s) now sets the slowest gate, and the build is what the layer cache addresses.

Every case runs exactly once. The unsharded run printed 44 case lines and the three parts 46. Without "the stand-ins start", which each part runs once, both lists hold the same 43 cases, sorted equal, with no duplicate and no failure.

Same findings on a dirty image. The planted-image case (a known value in a text file, in a binary and in docker history; a credential file; a token) passes in the image gate, as do the fail-closed cases (a crashed scanner, a scanner that reads nothing, an unreadable directory, a missing image, a broken dpkg database). On the real image, the check finds the same 460 detections inside package-owned trees and none outside them.

The layer cache (run 39719236090: three builds in sequence on one runner, BuildKit's local cache):

build packages.sh step total
from nothing 53.2 s 118 s
after a change under devcloud/boot CACHED 20 s
after a change to packages.sh rebuilt, 49.8 s 112 s

Live proof on GCE. devcloud vm image build --account gce baked dc-img-dee63a031ef3-… in 7m17s, and its builder was deleted. devcloud vm up --project SSFSKIM/doperpowers@devcloud-image-layers was created from that image, ready in 3m39s, and devcloud status showed all 12 steps ok, projects included. The same day, the VM was taken down and the image deleted; no other devcloud image existed on the account. No adopt was run: the container integration covers setup.sh on a plain host.

Review. doperpowers:reviewer-medium reviewed 53b6587..ed5e6fd and found nothing material.

Residue

  1. Gates still need a build cache to reach (ci-kit unrelayed park answers on terminal tickets never drain #88, CI-opt). The layer split cuts each integration gate's image build from about 120–150 s to about 20 s once a gate can reach a cache across runs. Until then this PR's gain comes from the image check alone.
  2. A cached package layer goes stale. packages.sh installs "latest" from release URLs and apt repositories. Keyed on the file alone, a cross-run cache would keep testing its first build's package set while VMs bake fresh ones. When ci-kit's cache lands, the key should carry an age bound (a weekly component, say).
  3. check_image under colima. The export bind-mounts a temporary directory. Docker Desktop shares macOS's temp directories, but colima by default shares only $HOME. There the check fails closed with a hint. If someone runs the check under colima, the work directory should move under $HOME.

Sminos-Session: devcloud setup#639ca648 (macbook on macbook)

…ages.sh alone (board #116)

setup.sh runs image/packages.sh first, so a VM builder and adopt still run
one recipe; the Dockerfile runs packages.sh as its own RUN, before the build
inputs, and the rest of setup.sh after them with DEVCLOUD_PACKAGES=installed.
A change elsewhere in devcloud/ now reuses the package layer from a cache.
devcloud 0.8.1.

Sminos-Session: devcloud setup#639ca648 (macbook on macbook)
…parts (board #116)

Profiled on a CI runner, the image check's 96 s was the export: the
rootfs streamed out through docker run's attach took 82 s, the bun scan
9.5 s and dpkg 4.4 s. A tar inside a container of the image onto a bind
mount copies the same files (listing equal) in 6 s, so the scan is not
sharded (4 shards would save about 5 s). With the image part down to
about 30 s, the one-shot cases join it and projects joins host.

Sminos-Session: devcloud setup#639ca648 (macbook on macbook)
Sminos-Session: devcloud setup#639ca648 (macbook on macbook)
Sminos-Session: devcloud setup#639ca648 (macbook on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T04:02:27.526241Z 2ed14dc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sminos-Session: devcloud setup#639ca648 (macbook on macbook)
@SSFSKIM
SSFSKIM merged commit a49fb15 into main Oct 22, 2026
10 checks passed
@SSFSKIM
SSFSKIM deleted the devcloud-image-layers branch October 22, 2026 04:09
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