Skip to content

perf(ci): build the Service image once for its test shards - #5079

Merged
dan-petty merged 2 commits into
mainfrom
perf/4642-service-image-once
Nov 12, 2026
Merged

dan-petty merged 2 commits into
mainfrom
perf/4642-service-image-once

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Each of the six Service Image Tests shards built the service stage again. A new job, Service Image Build, builds it once and uploads it as an artifact, as the Docker guide "Share built image between jobs" does. Each shard needs that job and runs docker load, so no shard has a build step.

The build step uploads no build record: a failed artifact service once held a shard for 631 s in that upload. The shards print their 10 slowest tests and each skip reason (--durations=10, -rs). They restore no tooling cache: setup-toolchain skips its cache step on empty paths. The #1643 invariant accepts the image that a needed job exports, and fails when a shard builds again.

Closes #4642

Change: openspec/changes/archive/2026-11-12-4642-build-the-service-image-once-for/

A new job, Service Image Build, builds the service stage once and uploads it as an artifact. Each of the six Service Image Tests shards needs that job, downloads the archive and runs docker load, so no shard builds the image. Before, the Buildx setup, the build and their post steps took 100.5 s of each shard on average.

The build step uploads no build record, because a failed artifact service held a shard for 631 s in that upload. The shards print their 10 slowest tests and the reason for each skip, and they restore no tooling cache: setup-toolchain skips its cache step on empty paths. The #1643 invariant accepts the image that a needed job exports and the shard loads, and fails when a shard builds the image again.

Closes #4642
@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Measurements (Actions API)

Before: 15 successful Service Image Tests runs of 2026-11-12 (90 shard jobs). After: run 43230528359 of this pull request.

Before After
Builds of the service stage per run 6 1
Shard job, mean 298.7 s 234.8 s (-63.9 s)
Shard job, max 374 s 281 s
Shard steps other than the test step, mean 148.4 s 71.0 s
Buildx, build and their post steps per shard, mean 100.5 s 0 s
Download and docker load per shard, mean 0 s 23.2 s (max 39 s)
Service Image Build job none 107 s (build 80 s, upload 3 s)
Runner time per run (all jobs of the workflow) 29.9 min 25.3 min
  • The test step took 163.8 s on average in the after run and 150.3 s before. The shard mean includes that difference.
  • The run took 653 s from start to end, with queue time. Before, the mean was 489 s and the median 399 s, also with queue time. The shards now start after the build job, about 107 s later.
  • The log of shard 4 shows slowest 10 durations, a SKIPPED [1] <file>:<line>: <reason> line for each of its 7 skips, and Restore tooling caches ... outcome=skipped.

fail-to-pass

uv run devops ci fail-to-pass --base origin/main: 17 of the changed tests fail on the base and pass on the head (354 pass on both), in tests/commands/test_ci.py, tests/invariants/test_architectural_invariants.py and tests/invariants/test_workflow_contracts.py. Exit code 0.

Owner steps

None. Service Image Build and the shards are not required checks, so the ruleset does not change.

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 14:09
@dan-petty
dan-petty merged commit dcf5bd5 into main Nov 12, 2026
30 checks passed
@dan-petty
dan-petty deleted the perf/4642-service-image-once branch November 12, 2026 14:10
@dan-petty

Copy link
Copy Markdown
Owner Author

Review findings for this pull request, and what I did. The pull request was merged, so the fix is in a follow-up pull request.

  1. Major, confirmed. .github/workflows/service-image-test.yml gave pytest -rs. The -r option of pytest replaces its default fE, so the short summary of a failed shard gave only the skip reasons and did not name the failed and error tests (AGENTS.md rule 14). I confirmed it with a probe on pytest 9.1.1 with -n 2: -rs gave only the SKIPPED line, and -rfEs gave also FAILED test_rs_probe.py::test_bad - assert 1 == 2. I filed fix(ci): keep failed test IDs in the service image shard summary #5103 and opened fix(ci): keep failed test IDs in the service image shard summary #5106. The shard step now gives -rfEs, and the workflow shape test reads the characters from CONST_CI_SHARD_SUMMARY_CHARS, the summary of the devops ci shard row (chore(ci): keep the per-test times and skip reasons of CI #4673). docs/SDLC.md and the ci-service-image-tests spec say that a shard names each failed test.

dan-petty added a commit that referenced this pull request Nov 12, 2026
The shard test step of Service Image Tests gave pytest `-rs` (#5079).
The `-r` option of pytest replaces its default report characters `fE`,
so the short summary of a failed shard gave only the skip reasons and
did not name the failed and error tests. The step now gives `-rfEs`: the
summary gives each skip reason and names each failed and error test
again.

The workflow shape test builds the expected option from
`CONST_CI_SHARD_SUMMARY_CHARS`, the summary characters of the `devops
ci` shard row (#4673), so the two kinds of shard keep one summary.
`docs/SDLC.md` and the `ci-service-image-tests` spec say that a shard
names each failed test.

Closes #5103

Change:
`openspec/changes/archive/2026-11-12-5103-keep-failed-test-ids-in-the/`
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.119.0](v0.118.0...v0.119.0)
(2026-11-12)


### Features

* **repos:** the claim sets In Progress
([#5111](#5111))
([06ef1c6](06ef1c6))
* **roadmap:** a fix-plan step repairs a plan PR with open findings
([#5104](#5104))
([ca5b16d](ca5b16d))
* **roadmap:** extend stage review rounds while open findings drop
([#5090](#5090))
([bacf713](bacf713))
* **roadmap:** re-anchor a stale citation that matches one line
([#5040](#5040))
([16356d8](16356d8))


### Bug Fixes

* **ci:** keep failed test IDs in the service image shard summary
([#5106](#5106))
([88589ef](88589ef))
* **github:** count each page of a paginated GitHub read
([#5070](#5070))
([908e24a](908e24a))
* **github:** keep the metrics permissions out of the runner Job token
([#5064](#5064))
([fb549ff](fb549ff))
* **github:** pace mutations through the clock seam
([#5063](#5063))
([2bd87bc](2bd87bc))
* **k8s:** delete the CoreDNS files that k3s never applies
([#5055](#5055))
([463f601](463f601))
* **monitoring:** tidy LLM stack windows, units and lines
([#5052](#5052))
([375d724](375d724))
* **roadmap:** a refused kept plan uses no stage gate return
([#4983](#4983))
([b8adbca](b8adbca))
* **roadmap:** count a command as removed only when MUST NOT governs it
([#4985](#4985))
([2e6f407](2e6f407))
* **roadmap:** cut prose after a cited stage command
([#4982](#4982))
([a172563](a172563))
* **roadmap:** name every module of a group with no named test
([#5089](#5089))
([27a0e79](27a0e79))
* **roadmap:** stage returns every open review finding to the planner
([#5067](#5067))
([21b116e](21b116e))
* **roadmap:** the alternatives check reads the tools in use
([#5062](#5062))
([8903233](8903233))
* **roadmap:** the constants gate reads 6_500 and no new value
([#5080](#5080))
([8a7b113](8a7b113))
* **roadmap:** the constants gate reads only a stated value
([#5042](#5042))
([cf4733e](cf4733e))
* **telemetry:** read repository traffic as the GitHub App
([#4932](#4932))
([7c42823](7c42823))
* **tests:** close the UDP, DNS and git gaps of the network floor
([#5101](#5101))
([047ee48](047ee48))
* **tests:** repair the bwrap contract suite and gate it
([#5110](#5110))
([9a0659d](9a0659d)),
closes [#4715](#4715)


### Performance Improvements

* **ci:** build the Service image once for its test shards
([#5079](#5079))
([dcf5bd5](dcf5bd5))
* **ci:** run only the required checks on the release PR
([#5057](#5057))
([8174071](8174071))
* **ci:** stop the cache export of pull request image builds
([#5113](#5113))
([ba30820](ba30820))
* **roadmap:** consolidate keeps its vectors in the shared tiers
([#5099](#5099))
([2a8bf1a](2a8bf1a))


### Code Refactoring

* **roadmap:** one Status writer for every job
([#5109](#5109))
([24cfedc](24cfedc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(ci): build the Service image once for its test shards

1 participant