Skip to content

docker: produce linera-tests image with remote-net test binary#6349

Merged
eldios merged 1 commit into
mainfrom
lele/network-health-check-test-image
May 21, 2026
Merged

docker: produce linera-tests image with remote-net test binary#6349
eldios merged 1 commit into
mainfrom
lele/network-health-check-test-image

Conversation

@eldios
Copy link
Copy Markdown
Collaborator

@eldios eldios commented May 21, 2026

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

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.

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 eldios self-assigned this May 21, 2026
@eldios eldios added this pull request to the merge queue May 21, 2026
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`.
Merged via the queue into main with commit 84121e2 May 21, 2026
40 checks passed
@eldios eldios deleted the lele/network-health-check-test-image branch May 21, 2026 01:53
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.
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