ci: add native freeBSD ci job

bitcoin/bitcoin: PR #36147

1 minor finding · 6 suggestions

Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.

Findings

Link

[minor] · The stated FreeBSD test exclusions are not configured

The FreeBSD job selects feature_reindex_init.py and p2p_private_broadcast_retry_v1.py despite the description saying they are excluded; their reported failure and slowness were not re-observed at this revision.

Location: ci/test/00_setup_env_freebsd_native.sh:16 (head).

Details and suggested fix

TEST_RUNNER_EXTRA="--extended" includes both scripts through ALL_SCRIPTS, and neither the workflow nor the shared invocation adds --exclude. The shared runner also passes --failfast, so a recurrence of the reported failure would stop the functional run and fail the job. Add --exclude feature_reindex_init --exclude p2p_private_broadcast_retry_v1 with a follow-up reference to implement the stated exclusions. If running both tests is now intentional, update the description instead.


Optional improvements

Link

[suggestion] · FreeBSD installation depends on a workflow-written internal sentinel

The hosted job bypasses installation successfully, but a bootstrapped FreeBSD host-mode run without ci.base-install-done reaches apt-get because the shared installer has no FreeBSD path.

Location: .github/workflows/ci.yml:638 (head).

Details and suggested fix

02_run_container.py always invokes 01_base_install.sh, including in host mode. The workflow avoids its non-macOS apt-get branch only by writing the installer's internal completion marker; the actual FreeBSD package installation exists only in YAML. Add a FreeBSD pkg/pip installation branch to the shared installer and call it from prepare after bootstrapping Bash and the tools needed to invoke it. Let the installer write its own marker and remove the workflow write. Preserve installation during preparation rather than repeating pip on every cached run. This is a reproduction and configuration-coupling issue, not an observed hosted-job failure.


Link

[suggestion] · FreeBSD parallelism stays fixed when the VM receives more CPUs

On larger VMs, MAKEJOBS=-j4 keeps requested build and test parallelism at four despite assigning all runner CPUs; the runtime effect is unmeasured.

Location: ci/test/00_setup_env_freebsd_native.sh:14 (head).

Details and suggested fix

The environment file overrides the shared nproc-based default, and the same value controls depends, cmake --build, ctest, and the functional runner. Drop the override so these stages scale with the CPUs assigned through BSD_CPU. If four concurrent functional tests are needed for stability, document that reason and apply the limit to the functional runner rather than also limiting both builds.


Link

[suggestion] · FreeBSD routable-bind coverage lacks address setup

Without routable aliases, both bind-port tests skip successfully; the job provides no setup, though guest addresses were not inspected, so this is a coverage opportunity rather than a regression.

Location: .github/workflows/ci.yml:634 (head).

Details and suggested fix

Host mode does not receive the routable addresses created by the Docker wrapper. feature_bind_port_discover.py and feature_bind_port_externalip.py fall back to 1.1.1.5 and 1111:1111::5, then raise SkipTest when binding fails, bypassing their address-discovery and port assertions. Configure the documented IPv4 and IPv6 aliases on an UP, non-loopback guest interface in the runtime CI step, not cached preparation. This would make the native job exercise these platform-specific checks instead of relying on the VM already having suitable addresses.


Link

[suggestion] · Native FreeBSD drops the previous REDUCE_EXPORTS coverage

The replacement omits -DREDUCE_EXPORTS=ON, so adding native tests also removes the previous FreeBSD hidden-visibility and export-reduction build coverage.

Location: ci/test/00_setup_env_freebsd_native.sh:18 (head).

Details and suggested fix

The deleted cross configuration explicitly enabled REDUCE_EXPORTS, but the new BITCOIN_CONFIG contains only --preset=dev-mode -DWITH_USDT=OFF. The option defaults to OFF, and the preset does not enable it. Add -DREDUCE_EXPORTS=ON to the native configuration to preserve that build coverage while testing the resulting binaries. If a native linking problem requires omitting it, document that limitation.


Link

[suggestion] · The trial-count commit also disables the unrelated ci-matrix

The final NOMERGE commit describes only reducing FreeBSD trials, but also comments out all 17 remaining matrix configurations, obscuring the substantive change during series review.

Location: .github/workflows/ci.yml:400 at 75b9e0728403 (commit) (commit).

Details and suggested fix

7cea966e259d3bbbbc36d4ad1cd3cb1101957bd5 replaces only FreeBSD Cross and preserves the other matrix jobs. b7eb815f72e32f4e072c7f8ef43e8637ccd2ee4b adds 20 robustness trials. 75b9e0728403fef8724bf881b4d16d7c1455e05d reduces those trials to one but also comments out the entire remaining ci-matrix, a much larger change absent from its message. Drop both temporary trial commits from the reviewed series to restore the substantive commit's workflow. If the experiment must remain during testing, isolate the matrix disabling in a clearly named NOMERGE commit so it can be understood and removed independently of the trial-count adjustment.


Link

[suggestion] · Shared portability changes are buried in the FreeBSD job commit

A preparatory commit would expose the shared reporting and depends changes independently, particularly the unexplained CONFIG_SHELL override removal; no current caller exporting CONFIG_SHELL was found.

Location: ci/test/03_test_script.sh:94 at 7cea966e259d (commit) (commit).

Details and suggested fix

7cea966e259d3bbbbc36d4ad1cd3cb1101957bd5 changes memory reporting, switches to uname -sr, introduces ${MAKE:-make}, and removes the explicit empty CONFIG_SHELL assignment, although its message describes only the BSD job layout. Move the 03_test_script.sh changes into a preceding portability commit and explain the shell-assignment removal there. The make fallback lets that preparatory commit stand without the later FreeBSD environment, which then supplies MAKE=gmake. This keeps the final tree unchanged while making the shared behavior changes easier to validate separately from the VM integration.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

SDK checksums were justified principally as integrity checks for directly downloaded, versioned archives—not as proof that the entire CI dependency supply chain is trusted or reproducible.

At the pinned base, FreeBSD base.txz is downloaded for a specified release, checked against a committed SHA-256, and then extracted as the cross-compilation sysroot. In the historical discussion, maflcko specifically distinguished curl failure detection from corruption caused by server hardware, and noted that an exactly versioned SDK permits version and checksum updates together. This is the requirement represented by the removed SDK check; it should not be conflated with a historical requirement to hash-pin every package or action.

Source 1 · Source 2

Broad CI hash pinning was contested because it can increase maintenance and review work without constraining recursive downloads or the complete execution environment.

This distinction matters when moving from a downloaded SDK to an external action plus pkg/pip provisioning. The historical objections explicitly covered container images, GitHub Actions, package managers, and the false impression that selectively pinned inputs make execution deterministic. The pinned base README records the resulting policy distinction: direct-download checksums versus generally unpinned other CI dependencies, including concern about delayed normal and security updates.

Source 1 · Source 2 · Source 3

Earlier runner-isolation work treated submitted CI jobs as potentially malicious remote-code execution and deliberately separated ephemeral execution state from persistent caches.

0xB10C described recreating a QEMU VM after each run, hardening host and guest services, restricting access to runner credentials, and using per-job overlay views of shared caches. The stated threats included cache vandalism, credential extraction, and adding a runner that could falsely report success. These are historical threat-model objectives, not evidence that the current Docker wrapper or proposed FreeBSD action provides the same guarantees.

Source 1

Caching served both performance and availability: avoiding repeated image/dependency builds, source downloads, registry rate limits, and network failures.

The historical cache inventory separated image-build caches, ccache, depends sources, built depends, and previous releases. That distinction maps to the proposed prepared-image cache alongside the existing build caches. The record supports retaining expensive preparation results without implying that arbitrary post-test VM state should persist. It also explains why an uncached path still matters: caches are accelerators for constructing the test environment, rather than the definition of that environment.

Source 1 · Source 2

CI configurations have been changed according to the distinct coverage they supply; native testing and cross-compilation have not been treated as interchangeable labels.

In #31651, a CentOS cross-build was described as mostly redundant with another i686 task, while conversion to a native task enabled execution on other supported architectures. The same discussion recalled that the multiprocess task had been changed to i686 because the CentOS task missed an issue. It also explicitly removed CONFIG_SHELL for Bitcoin's CMake build while retaining its separate treatment in depends.

Source 1

Ralph's inferences

The requirements transfer by separating artifact integrity, dependency-update policy, execution isolation, and cache persistence—not by treating a VM image or action pin as a substitute for all four.

The head delegates FreeBSD startup and preparation to vmactions/freebsd-vm, installs packages with pkg/pip, enables prepared-image caching, and invokes shared scripts with DANGER_RUN_CI_ON_HOST inside the guest. Against the historical premises, the relevant requirements are integrity of fetched artifacts, an explicit trust boundary for the action and package repositories, containment of unsafe job execution and credentials, and separation of reusable prepared state from job-produced state. Prepared-image reuse also introduces an update-cadence question: floating package inputs are resolved during preparation, not necessarily on each cache hit. These are transferred design questions, not findings about the action's behavior.

Source 1 · Source 2 · Source 3

The existing matrix is a coverage inventory, not evidence that a single native FreeBSD job subsumes its other checks.

The pinned base configures FreeBSD Cross plus 17 other matrix entries: IWYU; 32-bit ARM; ASan/LSan/UBSan/integer; macOS cross-builds for arm64 and x86_64; NetBSD Cross; OpenBSD Cross; no-wallet; i686; sanitizer fuzzing; previous releases; Alpine/musl; tidy; TSan; MSan fuzzing; MSan; and riscv32 bare-metal static libbitcoin_consensus. Their distinct targets cover architecture/build portability, optional-feature configurations, instrumentation, static analysis, and compatibility. ARM explicitly disables unit and functional tests, while the old FreeBSD configuration is build-only. Thus the historical baseline for this replacement is FreeBSD build coverage augmented by native execution; the other entries remain separate configured coverage. The retrieved evidence does not establish that every entry is a branch-protection-required status check.

Source 1

Explicitly clearing CONFIG_SHELL most plausibly kept Bitcoin's selected configure shell from implicitly controlling dependency builds; removing the variable is not semantically identical to assigning it an empty value.

Historically, CI deliberately exercised another configure shell, and #31651 later distinguished Bitcoin's obsolete post-CMake CONFIG_SHELL setting from depends' retained shell handling. At the pinned base, Alpine supplies dash to depends while other jobs explicitly supply CONFIG_SHELL=. At the head, the latter becomes no assignment, which permits an inherited value if one exists. This supports a configuration-separation interpretation, but the inspected record does not establish the original author's exact motivation or whether any current job supplies such an inherited value.

Source 1 · Source 2

Unresolved disagreements

The inspected discussion does not settle how much dependency drift ordinary pre-merge CI should intentionally absorb.

One position favored partially pinning inputs to minimize externally controlled changes and supply-chain exposure. Another objected that partial pins leave important inputs uncontrolled while adding maintenance. Will Clark also described floating images as useful for detecting toolchain/package breakage, whereas maflcko argued that most bleeding-edge testing belongs outside this repository because excessive unrelated failures can mark every PR red. SDK verification was reported merged and a policy note appears at the pinned base, but neither fact resolves the appropriate freshness cadence for a persistent prepared FreeBSD image.

Source 1 · Source 2 · Source 3 · Source 4