feat(build): produce per-arch pushed-artifact tarballs for native add-ons (#3425) #3470
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!3470
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/addon-bundle-tarball"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
delivery-models task 1.2 (build half) — produce the per-arch signed-able
pushed-artifactgzip tarball at build time.The agent side already lands:
stageAddonArtifactfetches an artifact, verifies sha256 + ed25519, and auto-detects a gzip tarball (binary + manifest/config + systemd units) vs. a bare binary, extracting the tarball flat undercurrent/(traversal/symlink/hardlink/decompression-bomb guarded). This PR adds the build side that produces that tarball, so a pushed-artifact add-on can ship units + config alongside its binary.Changes
build/native_addons/assemble_addon_bundle.py--tarball os/arch=out_path.write_tarball()emits a deterministic gzip tar: entries sorted by name,mtime=0,uid/gid=0, blank uname/gname, andgzip mtime=0so the.tar.gzis byte-for-byte reproducible (stable sha256 for signing). Binary is0755(named bybinary_name), manifest/config/units0644, all flattened to single-segment names — exactly what the agent'sextractAddonTarballexpects.tarball_file+tarball_sha256is recorded inmetadata.jsonnext to the existing bare-binarysha256.--tarball, the zip/sha/metadata output is unchanged (no tarball fields).build/native_addons/defs.bzl/addon_inventory.bzlpushed_artifact_tarball: Trueemits{name}.{os}.{arch}.tar.gzper platform plus anall_tarballsfilegroup.unit_entries(systemd.service/.timerunits) ship in both the zip bundle and the flattened tarball — the mechanism a systemd-supervised add-on (e.g. netprobe) will use.write_tarballpath (bare binary +addon.yaml+config.schema.json).Verification
Ran the assembler end to end locally against a crafted binary + manifest + systemd unit (bazel itself can't run here — CI is the build-side gate):
addon.yaml/config.schema.json/<binary>/<unit>; binary0755, rest0644; no zip name collision (realarchive_pathisbin/<os>/<arch>/<binary>, soPath(...).namecorrectly yields the binary name).tarball_sha256matches the on-disk file for both arches.--tarball, no tarball files and no tarball fields in metadata.py_compile+buildifier -mode=checkclean;openspec validate add-native-addon-delivery-models --strictpasses.Downstream (not in this PR)
artifact_sha256=tarball_sha256) belong to the build-signing change's sign/publish half — secret-blocked (Cosign + ed25519 upload keys).metadata.jsonnow carriestarball_file/tarball_sha256so the release/discovery-index step can pick the tarball without re-deriving it.os-packageadd-on template (the other prong of task 1.2) is still pending.tasks.md
Updated
add-native-addon-delivery-models/tasks.md1.2 to reflect both the agent-side extraction and this build-side production are done; remaining = tarball signing (build-signing, secret-blocked) +os-packagetemplate.🤖 Generated with Claude Code
delivery-models task 1.2 (build half). The agent already fetches, verifies, and extracts a gzip-tarball pushed-artifact (binary + manifest/config + systemd units, flattened under current/); this adds the build side that produces it. assemble_addon_bundle.py: - new --tarball os/arch=out_path; write_tarball() emits a deterministic gzip tar (entries sorted, mtime=0, uid/gid=0, gzip mtime=0 for a reproducible sha256), binary 0755 + manifest/config/units 0644, all flattened to single-segment names matching the agent's extractAddonTarball. - per-arch tarball name + sha256 recorded in metadata.json alongside the bare binary sha256; no --tarball -> output is byte-for-byte unchanged. defs.bzl / addon_inventory.bzl: - bundles that set pushed_artifact_tarball: True emit {name}.{os}.{arch}.tar.gz plus an all_tarballs filegroup; optional unit_entries ship systemd units in the bundle/tarball. Both samples opt in so CI exercises the path. Verified locally end to end: tarball layout/modes, byte-for-byte reproducibility across runs, metadata sha256 matches the file, and backward-compat without --tarball. buildifier + py_compile clean; openspec --strict passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>lgtm