build(ebpf): stop committing bpf2go-compiled artifacts - #302
Merged
Conversation
ecv
previously approved these changes
Aug 7, 2026
internal/plumbing/ebpf/prog's usid_bpfel.o/usid_bpfeb.o (and their generated .go bindings) were committed to git and go:embed'd into the binaries. Unlike other generated code (*.pb.go), these embed a compiled binary blob, so a stale commit could silently drift out of sync with usid.c with nothing but a byte-diff to catch it. Gitignore the four generated files and require every build site to regenerate them from usid.c via bpf2go instead: - Taskfile.yaml: build:ebpf now unconditionally regenerates (clang required, via a new require-clang check) instead of falling back to a committed copy when clang is missing. Reordered `build` so build:ebpf runs before fmt/vet, which need the embed target to compile. Added build:ebpf as a dependency of lint, lint-fix, test:unit, test:unit-root, and test:e2e. - ci.yaml: install the pinned clang-18/llvm-18/linux-libc-dev toolchain in the lint, test-unit, test-unit-root, and test-e2e jobs (previously only the build job had it). Removed the build job's `git diff --exit-code` drift check -- there's nothing committed to diff against anymore. - containers/galactic-cni/Dockerfile and containers/galactic-router/Dockerfile (the latter transitively imports internal/plumbing/ebpf/prog via usidmap): install a clang toolchain and run `go generate` in the builder stage instead of relying on a committed .o. - doc.go: documented the new convention and why it differs from the repo's committed-generated-code norm. Trade-off: clang is now a hard build requirement everywhere (dev machines, every CI job, both Dockerfiles) -- there's no more build-against-the-stale-committed-copy fallback when it's missing. Verified: task build/lint/test:unit pass from a clean regeneration; both Dockerfiles build successfully with the new toolchain step.
privateip
force-pushed
the
build/stop-committing-ebpf-artifacts
branch
from
August 8, 2026 01:24
4cd5474 to
eb755c3
Compare
This was referenced Aug 8, 2026
0xmc
approved these changes
Aug 8, 2026
0xmc
left a comment
Contributor
There was a problem hiding this comment.
Good changes. I love not have .o files in git. Some things to consider for a followup:
Make CI DRY-er
Create .github/actions/install-ebpf-deps/action.yaml:
name: Install eBPF build dependencies
description: Installs the pinned clang/llvm/linux-libc-dev toolchain needed to regenerate internal/plumbing/ebpf/prog's bpf2go output
runs:
using: composite
steps:
- run: |
sudo apt-get update
sudo apt-get install -y clang-18 llvm-18 linux-libc-dev
shell: bash
Then each job replaces its 4-line run: block with:
- name: Install eBPF build dependencies
uses: ./.github/actions/install-ebpf-deps
And Claude has recently(?) gotten overly verbose with its comments in code. My prompt is something along the lines of "no exposition in comments"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/plumbing/ebpf/prog'susid_bpfel.o/usid_bpfeb.o(and their bpf2go-generated.gobindings) were committed to git andgo:embed'd into the binaries. Unlike other generated code (*.pb.go), these embed a compiled binary blob, so a stale commit could silently drift out of sync withusid.cwith nothing but a byte-diff to catch it.This gitignores the four generated files and requires every build site to regenerate them from
usid.cvia bpf2go instead of shipping a checked-in copy.Changes
Taskfile.yaml:build:ebpfnow unconditionally regenerates (clang required, via a newrequire-clangcheck) instead of falling back to a committed copy when clang is missing. Reorderedbuildsobuild:ebpfruns beforefmt/vet, which need the embed target to compile. Addedbuild:ebpfas a dependency oflint,lint-fix,test:unit,test:unit-root, andtest:e2e.ci.yaml: installs the pinnedclang-18/llvm-18/linux-libc-devtoolchain in thelint,test-unit,test-unit-root, andtest-e2ejobs (previously only thebuildjob had it). Removed thebuildjob'sgit diff --exit-codedrift check — there's nothing committed to diff against anymore.containers/galactic-cni/Dockerfileandcontainers/galactic-router/Dockerfile(the latter transitively importsinternal/plumbing/ebpf/progviausidmap): install a clang toolchain and rungo generatein the builder stage instead of relying on a committed.o.doc.go: documents the new convention and why it differs from the repo's committed-generated-code norm.Trade-off
clang is now a hard build requirement everywhere (dev machines, every CI job, both Dockerfiles) — there's no more build-against-the-stale-committed-copy fallback when it's missing.
Verification
task build,task lint,task test:unitall pass from a clean regeneration.containers/galactic-cni/Dockerfileandcontainers/galactic-router/Dockerfilebuild successfully with the new toolchain step (verified locally viadocker build).🤖 Generated with Claude Code