initbin

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package initbin embeds the prebuilt moat-init entrypoint binaries (cmd/moat-init cross-compiled static for linux/amd64 and linux/arm64) so the moat host binary can ship them into run images without any network fetch at image-build time.

The committed blobs under embed/ are human-readable fail-closed stubs (a tiny shell script that prints a FATAL message and exits 1), so a fresh clone always compiles. `go generate ./internal/initbin` cross-compiles the real binaries over the stubs and refreshes checksums.txt; it is wired into `make build` and the goreleaser before hook (`go generate ./...`). Never commit the regenerated real blobs — `make restore-init-stubs` puts the stubs back.

The embed directory is deliberately named embed/ (not dist/): the repo's .gitignore has a bare `dist/` that matches at any depth and would silently untrack the committed stubs.

Index

Constants

This section is empty.

Variables

View Source
var Checksums string

Functions

func Binary

func Binary() []byte

Binary returns the embedded entrypoint matching the host architecture, or nil on architectures moat does not build run images for.

func BinaryFor

func BinaryFor(goarch string) []byte

BinaryFor returns the embedded entrypoint for a GOARCH, or nil when no binary is embedded for that architecture. Run images are always built for the host's own architecture, so runtime.GOARCH selects the right blob.

func IsStub

func IsStub(b []byte) bool

IsStub reports whether b is the committed fail-closed placeholder rather than a real cross-compiled entrypoint. Three layers keep a stub from serving as PID 1: the release gate (internal/initbin/gate, wired into the goreleaser before hooks) refuses to release stub bytes and execs the regenerated binary's --plan as a positive functional check; the e2e acceptance harness skips when the test binary embeds a stub; and the stub itself fails loudly at runtime — the backstop for channels that bypass generation entirely (`go install`, bare `go build`). Because the Go binary is now the sole entrypoint (no shell fallback), a stub shipped that way makes the container fail closed at PID 1 with the stub's rebuild message rather than silently skipping the privilege drop.

Types

This section is empty.

Directories

Path Synopsis
Command gate is the release pipeline's ship-refusal + positive functional gate for the embedded moat-init binaries (plan §5).
Command gate is the release pipeline's ship-refusal + positive functional gate for the embedded moat-init binaries (plan §5).
Command gen cross-compiles cmd/moat-init into the embed/ blobs and refreshes checksums.txt.
Command gen cross-compiles cmd/moat-init into the embed/ blobs and refreshes checksums.txt.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL