docker: produce linera-tests image with remote-net test binary#6349
Merged
Conversation
The daily network-health-check CronJob in linera-infra currently bootstraps a
rust toolchain, git-clones this repo, and runs `cargo test --release` from
scratch — ~30 min wall-time and ~10-15 GiB peak RSS for the final linera-bin
thin-LTO link, just to execute the remote_net_grpc integration tests against
the live testnet. The compile phase is rebuilt every day for the same commit;
that's the part Mat and Andre signed off on removing.
Move the build to where it belongs:
- Dockerfile: add `tests-builder` stage that does `cargo test --no-run -p
linera-service --features remote-net --test linera_net_tests`, parses the
JSON output to locate the executable produced in the cache-mounted target
dir, and copies it out to `/linera_net_tests`. Adds a `tests` runtime stage
built `FROM runtime` that bundles the test binary alongside the CLI, with
`/linera` symlinked into PATH so `Command::new("linera")` in the test
cli-wrappers resolves. The production `runtime` stage is unchanged — same
binaries, same layers, same digest path.
- docker_image.yml: build and push `linera-tests:{branch,short,long}` in
parallel with the existing 5 images, reusing the same Dockerfile via
`--target tests`. BuildKit dedups the shared `chef`/`planner`/`builder_src`
stages between the two `docker build` invocations so this adds the test
compile only — not a second copy of the production build.
Net effect downstream: the CronJob shrinks from a 40-min/12-26 GiB cargo job
to a `docker pull` + `linera-net-tests` invocation (~2 min, <1 GiB). Build
moves from "every day per CronJob" to "every push on devnet_*/testnet_*",
which is what CI is for.
Refs: linera-infra#1188
eldios
added a commit
that referenced
this pull request
May 21, 2026
Backport of #6349 to `testnet_conway` so the daily network-health-check CronJob (linera-infra) can consume `linera-tests:testnet_conway_release` once this branch's `Docker Image` workflow runs. ## Summary - New Dockerfile stages: `tests-builder` runs `cargo test --no-run -p linera-service --features remote-net --test linera_net_tests` and extracts the executable from cargo's JSON output; `tests` is built `FROM runtime` and bundles the test binary alongside the CLI (symlinked into PATH so `Command::new("linera")` resolves). - Workflow `docker_image.yml` builds and pushes `linera-tests:{branch,sha_short,sha_long}` in parallel via `--target tests`. BuildKit dedups the shared chef/planner/builder_src stages between the two builds. - Production `linera:<tag>` image (target=runtime) is unchanged. Refs: linera-io/linera-infra#1188 Related: #6349 ## Test plan - `docker buildx build --check --target tests`: clean (no warnings). - Verified the existing `runtime` stage is byte-identical: only new stages added after it, no edits to its COPY/RUN steps. - The added `jq` apt package in the chef stage is the only delta to the production build path; chef cache key is still cargo-chef's `recipe.json`, so unchanged. - End-to-end validation (image pushed by this workflow → consumed by the linera-infra CronJob) happens when this lands and triggers the `Docker Image` workflow against `testnet_conway`.
ma2bd
pushed a commit
to ma2bd/linera-protocol
that referenced
this pull request
May 21, 2026
## Summary One-liner fix to linera-io#6349: that PR added the LineraTests `build_and_push` call and its PID handling but omitted the `LINERA_TESTS:linera-tests` entry in the `for IMAGE_VAR in …` loop that populates the `<VAR>_IMAGE_{BRANCH,SHORT,LONG}` env vars. As a result the LineraTests sub-build receives empty `-t \"\"` flags and docker rejects them with: ``` ERROR: failed to build: invalid tag "": repository name must have at least one component ``` The four production images (`linera`, `linera-indexer`, `linera-explorer`, `linera-exporter`) build and push normally — only `linera-tests` fails. Verified on the `testnet_conway` run that fired on the linera-io#6350 merge (linera-io/linera-protocol/actions/runs/26200303794). Same fix is going up against `testnet_conway` as linera-io#6354 so the daily `network-health-check` CronJob (linera-infra) can finally find the `linera-tests:testnet_conway_release` tag. Refs: linera-io/linera-infra#1188 ## Test plan - Verified locally by re-rendering the env-vars step with the patched loop in a shell and confirming all three `LINERA_TESTS_IMAGE_*` values resolve to the expected `us-docker.pkg.dev/linera-io-dev/linera-public-registry/linera-tests:<tag>` URIs. - Real validation happens at merge time: the `Docker Image` workflow re-fires on `main` and either pushes a `linera-tests:main` (and short/long sha) tag, or fails differently — at which point we'll know the loop fix was sufficient.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests-builderrunscargo test --no-run -p linera-service --features remote-net --test linera_net_testsand extracts the executable from cargo's JSON output;testsis builtFROM runtimeand bundles the test binary alongside the CLI (symlinked into PATH soCommand::new("linera")resolves).docker_image.ymlbuilds and pusheslinera-tests:{branch,sha_short,sha_long}in parallel via--target tests. BuildKit dedups the shared chef/planner/builder_src stages between the two builds.linera:<tag>image (target=runtime) is unchanged.Refs: linera-io/linera-infra#1188
Test plan
docker buildx build --check --target tests: clean (no warnings).runtimestage is byte-identical: only new stages added after it, no edits to its COPY/RUN steps.jqapt package in the chef stage is the only delta to the production build path; chef cache key is still cargo-chef'srecipe.json, so unchanged.Docker Imageworkflow.