Skip to content

Release workflow: ship a real BPF ELF across every target#8

Merged
lunarthegrey merged 1 commit into
mainfrom
pr8-release-real-bpf
Apr 21, 2026
Merged

Release workflow: ship a real BPF ELF across every target#8
lunarthegrey merged 1 commit into
mainfrom
pr8-release-real-bpf

Conversation

@lunarthegrey
Copy link
Copy Markdown
Contributor

@lunarthegrey lunarthegrey commented Apr 21, 2026

Summary

v0.0.1's release.yml used cross build inside Docker containers that lack rustup + nightly + bpf-linker. build.rs silently stubbed the BPF ELF, and every shipped binary would fail attach with "no BPF ELF embedded". This PR closes the v0.1.0-tag blocker.

Changes

New build.rs override: PACKETFRAME_BPF_OBJ_PATH=<path>

  • When set, copies the file into OUT_DIR, verifies ELF magic, skips the nested-cargo build entirely.
  • Panics on missing file or non-ELF content — refuse to embed a broken object.

release.yml restructured into 3 jobs:

  1. bpf — builds BPF ELF on the host runner, uploads fast-path.bpf.o artifact.
  2. build (matrix of 4 targets) — downloads the artifact, forwards PACKETFRAME_BPF_OBJ_PATH into the cross Docker container via CROSS_CONTAINER_OPTS, cross-builds userspace.
  3. publish — unchanged except for a dry-run gate on workflow_dispatch.

Validation

Triggered the workflow via workflow_dispatch with dry_run=true on this branch (run 24718009128):

  • build BPF ELF — produced a 12,656-byte ELF, uploaded as artifact
  • ✅ 4× build <target> — each logged Using pre-built BPF ELF from PACKETFRAME_BPF_OBJ_PATH (12656 bytes), no stub-fallback
  • publish release — correctly skipped via dry_run gate

Downloaded the release-x86_64-unknown-linux-gnu artifact and confirmed the 2.28 MB binary embeds the real BPF ELF.

Test plan

  • Local: PACKETFRAME_BPF_OBJ_PATH=<real-ELF> cargo check uses override path
  • Local: missing file → panic; non-ELF content → panic
  • Workflow dispatch dry-run: bpf job green, 4 cross-builds green, publish skipped
  • Extracted artifact tarball — real 12,656-byte BPF ELF embedded (not stub)

Remaining: tag v0.1.0-rc1 post-merge to validate full publish path before tagging v0.1.0.

🤖 Generated with Claude Code

v0.0.1's release.yml used `cross build --release` inside Docker
containers that lack rustup + nightly + bpf-linker, so `build.rs`
silently fell back to the stub ELF and published binaries carried a
zero-byte BPF object. Every attach on a shipped binary would fail
with "no BPF ELF embedded in the binary".

Restructure into three jobs:

1. `bpf` — builds the BPF ELF once on the host runner (rustup/nightly/
   bpf-linker all available), uploads `fast-path.bpf.o` as an artifact.
2. `build` (matrix of 4 targets) — downloads the artifact, sets
   `PACKETFRAME_BPF_OBJ_PATH` pointing at it (cross forwards the env
   into the Docker container via `CROSS_CONTAINER_OPTS`), cross-builds
   userspace which embeds the pre-built ELF verbatim.
3. `publish` — unchanged except for a dry_run gate on workflow_dispatch.

New `build.rs` override path (`PACKETFRAME_BPF_OBJ_PATH`):
- When set, copies the file into OUT_DIR, verifies ELF magic,
  sets `packetframe_bpf_built` cfg. Skips the nested-cargo invocation
  entirely.
- Panics on a missing file or non-ELF content — refuse to publish a
  binary with a broken object rather than silent-stub as the old path
  did.

Added `workflow_dispatch` with a `dry_run: true` default so
maintainers can exercise bpf + cross-build from any branch without
creating a GitHub release.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lunarthegrey lunarthegrey merged commit e0810b4 into main Apr 21, 2026
13 checks passed
@lunarthegrey lunarthegrey deleted the pr8-release-real-bpf branch April 24, 2026 03:01
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