Skip to content

Ship a prebuilt agent binary instead of the crate source - #5

Merged
jetm merged 1 commit into
release-matrix-by-feedfrom
prebuilt-binaries
Sep 15, 2026
Merged

jetm merged 1 commit into
release-matrix-by-feedfrom
prebuilt-binaries

Conversation

@jetm

@jetm jetm commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Stacked on #3 (base is release-matrix-by-feed, not main).

Problem

Following the published guide end to end from a clean project fails at build.
avocado ext package runs no build step, so the published RPM can only carry what
is in the repo - which made it a source package and pushed the compile onto the
consumer. A consumer has no Rust cross toolchain in their SDK, and the extension's
own sdk.packages do not travel with a package-sourced extension:

warning: ring@0.17.14: ToolNotFound: failed to find tool "x86_64-avocado-linux-gcc"
error: failed to run custom build command for `ring v0.17.14`

avocado install and the extension's own sysroot creation both reported success
first, so nothing pointed at the extension.

Solution

Fetch a prebuilt artifact, which is what ext-microclaw does. The release path has
nowhere to compile, so the only question is who compiles and when; doing it in this
repo's CI puts it where the toolchain is already known-good.

Static musl, not gnu. A gnu build pins the runner's glibc version into the
artifact and fails on older devices at exec time. Static musl has no libc coupling,
so one artifact per architecture serves every target of that architecture.

Verification

Both architectures build under cross, ring included:

x86_64:   ELF 64-bit LSB pie executable, x86-64, static-pie linked, stripped   3.8M
aarch64:  ELF 64-bit LSB executable, ARM aarch64, statically linked, stripped  3.3M

The x86_64 binary runs - it reaches reading bootstrap at /var/lib/avocado/container-dev/bootstrap.json, which is correct without a bootstrap.

Hook error paths exercised directly: unmapped architecture exits 1, unset
architecture exits 1, absent staged binary exits 1, and the new architecture guard
rejects a real aarch64 binary staged for an x86_64 target:

Error: staged binary is not x86-64: ELF 64-bit LSB executable, ARM aarch64, statically linked
exit=1

Reviewer notes

  • The fetch itself cannot be exercised until a 0.2.0 release exists, since it pulls
    that release's own assets. Everything up to the fetch is tested above.
  • SHA256SUMS ships in the same release as the artifact, so it verifies the
    transfer rather than the provenance - the release is the trust anchor. That avoids
    pinning a digest in the hook, which would force every release through
    build-commit-tag just to record a hash the tag produces.
  • Triple resolution is gone from both hooks along with the compile. The ambiguity
    guard it carried is no longer needed here, but cli, connect, tunnels,
    jtop and microclaw still resolve by first prefix match in avocado-os and are
    still exposed on any target whose architecture matches the SDK host's.
  • Once this lands, the SDK-toolchain section added to the container dev mode guide
    in Publish the container dev mode guide and its two field notes peridio/docs#509 should be removed - consumers will need no toolchain.

Following the published guide end to end from a clean project does not
work. `avocado ext package` runs no build step, so the published RPM can
only carry what is in the repo - which made it a source package and
pushed the compile onto the consumer. A consumer has no Rust cross
toolchain in their SDK and no reason to, and the extension's own
sdk.packages do not travel with a package-sourced extension, so the
build died inside ring's build script looking for
x86_64-avocado-linux-gcc. Both `avocado install` and the extension's
sysroot creation had already reported success, so nothing pointed at the
extension.

Fetching a prebuilt artifact is what ext-microclaw does, and this is why
rather than convenience: the release path has nowhere to compile, so the
only question is who compiles and when. Doing it in the extension's own
CI puts it where the toolchain is already known-good.

The binaries are static musl rather than glibc. A gnu build pins the
runner's glibc version into the artifact and fails on any older device
at exec time; static musl has no libc coupling at all, so one artifact
per architecture serves every target of that architecture. Measured: 3.8
MB x86_64 static-pie, 3.3 MB aarch64 static, both built under `cross`,
ring included.

SHA256SUMS comes from the same release as the artifact, so it verifies
the transfer and not the provenance. That is proportionate for a
first-party artifact and avoids pinning a digest in the compile hook,
which would force every release through build, commit, then tag just to
record a hash the tag itself produces.

cad-install.sh now checks the staged binary's architecture against the
target. The packaged extension is noarch and nothing downstream
re-checks that the two agree, so a mismatch would install cleanly and
fail only when the device tried to exec it.

Triple resolution is gone from both hooks along with the compile. The
ambiguity guard it carried is no longer needed here, but the five
sibling extensions still resolve by first prefix match and are still
exposed on any target whose architecture matches the SDK host's.

Signed-off-by: Javier Tia <javier@peridio.com>
@jetm
jetm requested a review from nicksinas September 15, 2026 21:57
@jetm
jetm merged commit 3ba5456 into release-matrix-by-feed Sep 15, 2026
1 check failed
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.

2 participants