Skip to content

feat: a native builder, with buildkit as a host service - #41

Merged
blaipr merged 1 commit into
mainfrom
feat/native-builder
Nov 29, 2026
Merged

blaipr merged 1 commit into
mainfrom
feat/native-builder

Conversation

@blaipr

@blaipr blaipr commented Nov 29, 2026

Copy link
Copy Markdown
Member

--mode native --role builder was refused ("Its BuildKit runs in a container"). It now installs the Builder directly on the server, as root, without Docker or Podman.

What it installs

  • The builder: its static binary ansibleforms-rte-builder_linux_<arch> from the ansibleforms/builder release at the controller's version, checked against that release's SHA256SUMS (published from feat: the builder's binaries on each release builder#24 on)
  • BuildKit: moby/buildkit's release archive at BuildkitVersion (v0.35.1, the same as the builder image's pin), checked against a SHA-256 pinned per architecture in the code (moby/buildkit publishes no checksum files; the pinned sums are GitHub's asset digests)
  • Two systemd services: ansibleforms-buildkitd runs buildkitd --addr unix:///run/buildkit/buildkitd.sock --group <name> as root with the OCI worker (Type=notify), and <name> runs the builder as the system user <name>, Requires=/After= BuildKit
  • Its settings: builder.env with CONTROLLER_URL, RTE_NAME, RTE_TOKEN, RTE_JOIN_TOKEN when given, CONTROLLER_TLS_VERIFY=0 when the certificate is trusted, BUILDER_WORK_PATH on data/, BUILDKIT_HOST, and its probes on 127.0.0.1

The layout mirrors the native Runner's: releases/<version>/ (the binary and a link to its BuildKit), current, runtime/buildkit-<v>/, data/, buildkit/ (buildkitd's state and cache, root's), home/.

Upgrade, rollback, uninstall, takeover

  • An upgrade puts the new release next to the old one, writes both units again, stops both, moves current, starts both and waits for the builder's port; old releases and unused BuildKits are pruned
  • A rollback moves current back, so BuildKit goes back with it
  • An uninstall removes both services; with purge also the folder (BuildKit's cache included) and the user, never a database
  • A native Builder's unit is found and taken over when installer.json is missing; BuildKit's unit is not taken for AnsibleForms

Without root

Refused, in every language: a Builder installed directly needs root, its BuildKit runs as a root service; run the installer with sudo, or use Docker, Podman or Kubernetes.

Tests

  • Unit tests for every step and failure, with the native package's fakes; coverage stays 100.0%
  • By hand: the v0.35.1 archive's layout (bin/buildkitd, bin/buildkit-runc, bin/buildkit-qemu-*, bin/buildctl) matches the strip the code uses, and its SHA-256 matches GitHub's digests
  • By hand, under real systemd in a privileged Debian trixie container: the units and builder.env written by this code, systemctl enable --now of both. buildkitd reported ready, its socket root:bx 0660, the builder started on it and answered /live. As the builder's user, buildctl built for amd64 and arm64 (the archive's QEMU), another user was refused the socket, and the builder's own TestRealBuild built and pushed to a registry through that socket.
  • Not run for real: the installer binary end to end on a real host (no root here, and no builder release publishes binaries yet), an upgrade, and a builder joining a real controller.

README (roles table, Builder notes), CONTRIBUTING (how BuildKit's pin is bumped), CHANGELOG (Unreleased > Added) and the texts in all eleven languages.

@blaipr
blaipr merged commit 59a549f into main Nov 29, 2026
4 checks passed
@blaipr
blaipr deleted the feat/native-builder branch November 29, 2026 23:46
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