Skip to content

Bake the RigForge Rust release binary into the image, verified against its SHA256SUMS #4531

Backlog

Description

@pithead-architect

What's the problem

Part of #4212: the image build must carry the RigForge release binary for the pinned RigForge tag and check it against that release's SHA256SUMS before it is baked in. Today os/rootfs/Dockerfile bakes only the pinned RigForge tree (ARG RIGFORGE_REF, a 40-hex commit, fetched as a tarball) and stamps /opt/rigforge/RIGFORGE_REF with its ref and tree VERSION. No binary is fetched, and RigForge releases through v1.19.0 attach only source bundles plus SHA256SUMS — rigforge#708 adds the static x86_64-unknown-linux-musl asset. The build therefore has to bake the binary when the pinned release carries one and skip cleanly when it does not: appliances keep running the Bash path until then.

What it impacts

Every image built by os/build-image.sh, including every tier4-kvm phase build, and the static image gate tests/os/verify-image.sh (sourced by tests/os/run.sh on every battery image build).

How I found it

Required by pithead#4212 acceptance criterion 1. Read 2026-11-25: os/rootfs/Dockerfile (RigForge bake block and stamp), os/build-image.sh (PITHEAD_RIGFORGE_REF override), tests/os/verify-image.sh (rigforge chk rows), and the v1.19.0 release assets via gh release view (source tar.gz, zip, SHA256SUMS — no binary).

How important is it

The delivery piece of pithead#4212; blocks its AC1. The skip branch keeps every current image build green, so the Bash path is not at risk.

Acceptance criteria

  • A repo script (e.g. os/fetch-rigforge-rust.sh) takes the baked tree dir and a target dir, derives the release tag from the tree's VERSION, and fetches that release's asset list and SHA256SUMS from URL bases overridable by env so a fixture selftest needs no network. The baked tree is used for identity, so pin and binary cannot drift.
  • Fixture selftest (tests/os/selftest-rigforge-rust-bake.sh, auto-run by the make test-integration-selftest glob in CI shell.yml), RED before the logic and GREEN after: good asset → installed plus a recorded .sha256 and a stamp recording ref, version and sha256, exit 0; no matching asset → a printed skip line, nothing installed, exit 0; checksum mismatch → non-zero exit naming the mismatch, nothing installed; asset missing from that release's SHA256SUMS → treated as failure.
  • The Dockerfile calls it after the tree bake and bakes into /opt/rigforge/prebuilt/rust/ — the seed location, because pithead-sync never syncs top-level prebuilt as a tree file (the xmrig prebuilt pattern); installed root-owned mode 0755.
  • tests/os/verify-image.sh gains a chk row passing in both branches: no seed, or seed present with its recorded sha256 matching and the stamp's version equal to the baked tree's VERSION.
  • os/README.md gains a short block on what is baked and the skip rule; os/build-image.sh usage header updated if behavior becomes env-visible.
  • A cheap tier4-kvm phase on the head (e.g. --phase boot) shows the Dockerfile wiring against real GitHub with today's pin: build succeeds with the recorded skip.

Possible solutions

  • New script + one Dockerfile RUN: list assets from https://api.github.com/repos/p2pool-starter-stack/rigforge/releases/tags/<tag>, select the asset whose name contains x86_64-unknown-linux-musl (rigforge#708's stated target triple; tighten to the exact name when feat(#490): opt-in fail-closed miner hold on unrecoverable dashboard health failures #708 lands), verify with sha256sum -c against the matching SHA256SUMS line.
  • Once rigforge#708 pins the filename, drop the API listing for a direct release-download URL.

Parent: #4212

Worker brief: Test tier: tier1 (new tests/os/selftest-rigforge-rust-bake.sh is auto-run by the make test-integration-selftest glob, CI shell.yml) plus one cheapest tier4-kvm phase (--phase boot) on the head, because tests/os/verify-image.sh runs on every battery image build and proves the Dockerfile wiring against real GitHub.

Read first: os/rootfs/Dockerfile (RigForge bake block, stamp, xmrig prebuilt block), os/build-image.sh usage header and PITHEAD_RIGFORGE_REF, tests/os/verify-image.sh rigforge rows, any tests/os/selftest-*.sh for the fixture idiom, os/README.md. Parent: pithead#4212 (its AC1). Conforming contracts: rigforge#708 (static x86_64-unknown-linux-musl release asset covered by the release SHA256SUMS — open; all releases through v1.19.0 ship source bundles + SHA256SUMS only) and rigforge#707 (delivery ruling: appliances get the binary through the appliance updater; x86_64 required).

Defaults to take (record in the PR body under How I fixed it as shortcut/limitation lines if relevant): derive the release tag from the baked tree's VERSION (do not use latest); select the release asset whose name contains x86_64-unknown-linux-musl — when rigforge#708 names the exact asset, tighten this matcher in a follow-up on this issue's branch if needed. Bake under /opt/rigforge/prebuilt/rust/ with a .sha256 file and a ref/version/sha stamp, root-owned 0755.

Non-negotiables: fixture selftest covers good asset, absent asset (skip, exit 0), bad checksum (build fails, nothing installed), and asset-line missing from SHA256SUMS (failure); verify-image gains a chk row that passes on absent-or-verified; no network in the selftest (URL bases env-overridden); no comments in code; docs in os/README.md; run make lint-file-budget and make lint-pithead-build before the PR; submit the tier4-kvm job through bench-submit with --base develop-v2.1.0 on the pushed head and paste the bench-ci evidence block unedited; reference pithead#4212 and the rigforge issues fully qualified.

Activity

  1. added this to the v2.1.1 milestone on Nov 26, 2026
  2. added
    needs-triage
    size:M
    on Nov 26, 2026
  3. added
    bug
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triagesize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions