Skip to content

ci: build the live images once per platform and share them - #12995

Merged
cv merged 1 commit into
v1from
ci/shared-live-images
Oct 11, 2026
Merged

cv merged 1 commit into
v1from
ci/shared-live-images

Conversation

@cv

@cv cv commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Failure

Since #12970, Linux AMD64's live suites decide how long required checks take. In v1 run 38132223890, required checks finished at 1,001 s, waiting for linux_amd64 / Live / Docker; Windows and macOS were done by about 610 s.

Each live job builds its platform's agent image from scratch: OpenClaw on AMD64, Pi on ARM64. The Docker job also builds two proxy images. Docker and Kind each build the same agent image, so each platform builds it twice. On AMD64, that build took 300–303 s of each live job.

An experiment on hosted AMD64 runners (since deleted) measured the alternatives:

Approach Time
Build without a cache, as today 243 s
Build and export a layer cache to the Actions cache 472 s
Build with that cache imported 63 s
Save the built image and upload it (4.47 GB, 1.01 GB with zstd) 21 s
Download and load it 46 s

Decision

Build each Linux platform's live images once, in a job that starts with the run, and have both live jobs load them:

  • cargo ci live-images: an opt-in step that builds the agent image and both proxy images under nc-live-images. It streams docker save through the zstd command into .build/ci/live-images.tar.zst; uncompressed, the AMD64 images take 4.5 GB.
  • --images FILE: ci live-docker and ci live-kind load the archive and retag each image under the run's own fresh prefix. Digests and cleanup work as before: each run removes only the names it created. Without --images, both build as before.
  • Build live images job: runs alongside Build and test and Build bundle. It now makes the live decision, which moves from Build and test, so a pull request that can't affect the live suites builds no images and skips both live jobs.
  • Live jobs: wait for all three jobs and download the image archive along with the test archive and bundle.
  • Shared action: the containerd image store setup moves to .github/actions/containerd-store, which the image job and the live jobs both use. The image job builds under that store too, so saved images load the same way.

A layer cache would cut the image job further, but live jobs also wait for the bundle, ready at about 190–270 s on Linux. It would save at most about a minute, for 229 s of cache export on v1 pushes and 1.7 GB of cache per image, so this PR doesn't add one.

On AMD64, this PR's own run (38137587218) finished the image job at +382 s, and both live jobs started at +384 s instead of +261 s. Each skipped its image build, so required checks finished at +926 s instead of +1,001 s. That's 75 s, less than the 3 minutes I estimated: see the comment below.

Validation

  • New tests: three, written first and failing before the change, using fake docker and zstd commands. One more adds --images cases to the option-rejection test.
    • ci live-images builds Pi and both proxy images with the shared prefix and saves them in one docker save through zstd.
    • It refuses to run off Linux.
    • ci live-docker --images loads the archive, retags all three images under its own nc-live- prefix, and builds nothing.
  • Real run on Linux ARM64:
    • cargo ci live-images wrote a 177 MB archive with Docker's local build cache.
    • cargo ci live-docker --images passed all 10 Docker tests in 277 s, with no image builds and no nc-live- images left afterwards.
  • Kind metadata: the Kind suite reads the agent image's metadata from docker image save. A loaded image exports the same metadata as a freshly built one; only the blob key, which is each image's own digest, differs.
  • cargo ci passed in 464 s: 1,333 workspace tests and 129 lifecycle tests.
  • actionlint passes.
  • Not run locally: the Kind suite. This PR's own run executes both live suites on both Linux platforms.

@github-actions

Copy link
Copy Markdown
Contributor

@cv

cv commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

Measured in this PR's run, 38137587218, against v1 run 38132223890. Every job passed.

Before This PR
Required checks done +1,001 s +926 s
AMD64 Live / Docker 733 s, from +261 s 537 s, from +384 s
AMD64 Live / Kind 683 s 407 s
ARM64 Live / Docker 444 s 306 s
ARM64 Live / Kind 358 s 271 s
AMD64 Build live images (none) 380 s: 32 s Rust setup, 331 s building and saving, 8 s upload

In AMD64 Live / Docker, the tests now start 130 s into the suite step instead of 426 s, so loading the images saves about 200 s per Docker job. The saving on required checks is smaller for two reasons:

  • Later start: the live jobs now wait for the image job, which finishes at +382 s, after the bundle at +248 s.
  • Slower tests: the Docker tests themselves took 312 s here, against 267 s in the v1 run.

Each platform now builds its images once instead of twice, which also saves runner time. A layer cache in the image job would now save up to about 130 s on AMD64, by letting the live jobs start when the bundle is ready. That trade-off is different from the one in the description, so it would be a separate change.

@cv
cv merged commit 7d949a8 into v1 Oct 11, 2026
@cv
cv deleted the ci/shared-live-images branch October 11, 2026 19:35
cv added a commit that referenced this pull request Oct 11, 2026
…ts (#13001)

## Failure

Linux AMD64's `Live / Docker` job decides how long required checks take.
In #12995's run
([38137587218](https://github.com/NVIDIA/NemoClaw/actions/runs/38137587218)),
its tests took 313 s. One test,
`runtime::tests::retained_runtime_rebuilds_offline_without_protobuf_or_a_dependency_cache`,
took 163 s of that on AMD64 and 113 s of 232 s on ARM64.

The `live-docker` profile runs one test at a time because the tests
share one Docker engine. That test uses no engine at all: it compiles
the runtime in release mode from its retained source archive, offline,
with an empty `CARGO_HOME` and no `protoc`. It's in this profile only
because it needs Linux, yet every Docker test waits behind it.

## Decision

- **Test group:** a `docker-engine` nextest group that allows one test
at a time. An override for the `live-docker` profile puts every test
except the rebuild in it.
- **Threads:** the profile runs two tests at once. The Docker tests
still run one at a time, and the rebuild compiles alongside them.
- **Docs:** updated `testing.md` to say so.

The runner's later commands each select one gateway test, so they're
unchanged. On AMD64, the first command should drop from about 250 s to
roughly the rebuild's 163 s plus however much the compile slows the
Docker tests on a 4-CPU runner. This PR's own run measures that, because
`.config/nextest.toml` is a live input.

This doesn't depend on #12995, which shares the live images.

## Validation

- **Groups:** `cargo nextest show-config test-groups --profile
live-docker --run-ignored only` puts the other nine tests in
`docker-engine` and leaves the rebuild outside it.
- **Local run:** `cargo ci live-docker` passed all 10 tests on Linux
ARM64 in 258 s. In its JUnit report, the rebuild ran from 0 to 39 s
while the Docker tests ran one after another, and the first command took
143 s instead of 178 s. This machine compiles much faster than a hosted
runner, so CI should save more.
- **`cargo ci`** passed in 472 s: 1,336 workspace tests and 127
lifecycle tests. Afterwards, the documentation tests passed again with
the `testing.md` change.
cv added a commit that referenced this pull request Oct 11, 2026
Part of #12876: its last criterion, "the testing guide describes the
layers and budgets".

## Failure

`docs/contributing/testing.md` listed the step budgets but didn't
describe the unit, contract, system, and live layers, or which crates
and binaries belong to each. `docs/contributing/integration-tests.md`
had grown one fixture at a time, and some of its text no longer matched
the code:

- it named tests that no longer exist: `harness_codex`, the OpenClaw
interface lifecycle, and Hermes interface modes;
- it described ten Fabric harness tests, but `fabric_deployment` has two
(OpenClaw and Pi);
- its Docker tests are part of the `live-docker` suite, not the fixture
layers.

## Decision

- `testing.md` now has sections for the layers (what each checks, its
binaries, and what belongs there), how to run each layer with the one
`NEMOCLAW_TEST_BUNDLE` input, budgets and per-test limits (where each is
enforced and how to change one), timing reports, and how CI runs each
layer: jobs, partitions, archives, the Windows relay, and live suites on
pull requests. The dependency, image, schema, CLI, cache, and coverage
sections are unchanged.
- `integration-tests.md` now covers the contract and system layers: the
shared harness, each provider's contract binary by module, and the
system modules, built from the current test names.
- The four sections that need a real Docker engine move to
`live-tests.md` under a new Docker Live Suite section, next to the
Docker gateway tests already there. Their two inbound links are updated.
Other anchors are kept.
- After merging `v1` (#12995, #12996, #12998, #12999, #13000), the guide
describes what moved: the system layer's `nemoclaw-sdk` tests are now
only the Helm recovery tests, the OpenShell and Fabric backends'
fake-gateway tests (formerly `nemoclaw-e2e/tests/openshell.rs`) are
provider unit tests, the Kind suite runs `nemoclaw-e2e`'s
`kubernetes_live` and `kubernetes_chart`, and `Build live images` builds
the live images once and decides whether the live suites run.
- The `kubernetes_lifecycle` contract tests' `#[ignore]` reason named
`NEMOCLAW_TEST_TOFU` and `NEMOCLAW_TEST_PROVIDER`; it now names
`NEMOCLAW_TEST_BUNDLE`, which the tests read.
- Every statement was checked against `run_ci.rs`, `ci/timing.rs`,
`.config/`, the workflows, the `v1` ruleset, and the tests.

### Budget enforcement audit

Every budget in `.config/test-budgets.yaml` is enforced on the Linux
runners. In run
[38136353545](https://github.com/NVIDIA/NemoClaw/actions/runs/38136353545)
(linux_amd64), the `test`, `Lifecycle / 1`, `Live / Docker`, `Live /
Kind`, and `Lifecycle timing` logs each print their budget and "Within
budget." with no "reported only" note. The three binary budgets appear
in the `Lifecycle timing` table.

No budget is recorded but unenforced. These gaps remain:

- When `changes live` skips the live suites on a pull request, their
budgets aren't checked for that PR.
- The `test` wall budget covers the nextest run, not the doctests.
- `.config/test-budgets.yaml` isn't checked in the other direction. A
step key that names no step, or a binary budget whose binary has no
lifecycle tests (renamed, or every partition missing its report), passes
silently. `Lifecycle timing` names a partition with no report but
doesn't fail on it.

## Validation

- `cargo run --locked -p nemoclaw-build -- fern check`: 0 errors. Its
one warning is also on `v1`.
- `git diff --check`
- `cargo test -p nemoclaw-build --test integration ci::`: 15 passed.
- I ran the documented commands against a `linux_arm64` bundle:
- the nextest `lifecycle` command filtered to
`openshell-provider::contract` (44 passed);
  - `nemoclaw-sdk --lib -- --ignored helm_recovery` (5 passed);
  - `nemoclaw-e2e sandbox_readiness::` (1 passed);
  - `nemoclaw-provider --test contract service_readiness::` (2 passed);
  - `lifecycle-timing` on an empty directory.
- After the merge, against a rebuilt `linux_arm64` bundle: the same
commands again, plus `kubernetes_lifecycle::` (2 passed) and the
providers' `fake_gateway_tests` (3 and 9 passed); `cargo fmt --all
--check` and `cargo clippy --workspace --all-targets -- -D warnings`.
- No behavior changes: the only code change is an `#[ignore]` reason
string.
@cv cv added the v1 NemoClaw v1 branch label Oct 12, 2026
cv added a commit that referenced this pull request Oct 20, 2026
## Failure

Releases need the exact images CI checked (#13516), but `CI / Images`
discarded every image it built and checked. A release workflow would
have to rebuild them, and agent images are not reproducible byte for
byte, so the published digests would differ from the checked ones.

## Decision

Build once per commit, and let releases promote what was checked.

- **`image-build.yml` (new, reusable):**
  - it has the image job's steps, unchanged;
- it takes the validation plan's result, the image decision, and a
`push` switch;
- the calling job is named `Build` and its own job is named after the
platform, so the required checks keep their names (`Build /
linux_arm64`, `Build / linux_amd64`).
- **`images.yml`** calls it, with `push` only for pushes to `v1`. Pull
requests, stacked branches, and pushes that skip image work push
nothing.
- **When pushing,** after the existing checks pass, each agent image and
the Ollama proxy is pushed to
`ghcr.io/nvidia/nemoclaw/v1-ci/<image>:<commit>-<arch>` with the
workflow's own token:
- Docker's containerd store pushes the manifest it built, so the digest
doesn't change;
  - the job summary lists each digest and its push time;
- the job fails if any of those packages turns out public, since nothing
must be public before a release.
- **Left alone:** the live suites' `live-images` path, which is tuned to
stay behind the bundle on the critical path (#12995, #13188, #13239).

Later: the tag workflow that promotes these digests (#13516), and a
cleanup schedule for old per-commit tags.

## Validation

- `actionlint` reports nothing for both workflows.
- This pull request runs the same steps through the reusable workflow,
without pushing.
- **Not yet run:** the push step, which runs only on a `v1` push that
builds images. I'll watch the first one for push time and the new
packages' visibility; earlier, a package pushed with a personal token
started `internal`.
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance labels Oct 28, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants