Skip to content

ci: replace docker .rpm builds with cargo zigbuild#1471

Merged
kixelated merged 1 commit into
mainfrom
claude/nfpm-env-template
May 23, 2026
Merged

ci: replace docker .rpm builds with cargo zigbuild#1471
kixelated merged 1 commit into
mainfrom
claude/nfpm-env-template

Conversation

@kixelated
Copy link
Copy Markdown
Collaborator

@kixelated kixelated commented May 23, 2026

Summary

Two fixes folded together to get the release workflows actually green:

  1. envsubst pre-rendering before nfpm pkg. nfpm's ${VAR} expansion only fires on a small allow-list of top-level fields (name, arch, version); for contents[].src and contents[].dst the value flows straight into the glob handler, which treats ${BINARY_PATH} as a literal pattern and fails with glob failed: ${BINARY_PATH}: no matching files. {{ .Env.VAR }} doesn't help either: nfpm's templating doc lists the same restricted field set. Each .deb/.rpm step now does envsubst '$VERSION $ARCH ...' < nfpm.yaml > /tmp/nfpm.yaml before invoking nfpm.

  2. cargo zigbuild in place of the AlmaLinux 9 / Debian 12 docker rebuilds. The previous Package .rpm (and Package .deb for moq-gst) reinstalled Rust inside a container on every run just to link against an older glibc. That path was slow (~7-15 min, no cargo cache), fragile (hit curl-minimal vs curl dnf conflicts, exit-127 surprises), and easy to break invisibly. Replaced with cargo zigbuild --target <triple>.2.34, which produces one binary covering Debian 12+, Ubuntu 22.04+, and RHEL/Rocky/Alma 9+. The .deb and .rpm steps now point nfpm at the same artifact.

For moq-gst the deb and rpm jobs collapse into one package job per arch on ubuntu-24.04 (ships GStreamer 1.24, satisfies gstreamer-rs 0.23's >= 1.22 headers requirement). The resulting .so still dynamic-links to the host's libgstreamer-1.0.so.0, matching the existing nfpm >= 1.22 depends.

Wiring

  • cargo-zigbuild, zig, and gettext added to the .#packaging derivation so CI and local nix develop users share the toolchain.
  • nfpm.yaml libc6 depends drop from >= 2.35 / >= 2.36 to >= 2.34 to match the zigbuild floor.

Net diff

9 files, +89 / -153 (Docker block removal more than pays for the new lines).

Test plan

  • yaml.safe_load parses cleanly on all touched workflow and nfpm.yaml files.
  • PR dry-run exercises .deb and .rpm end-to-end for moq-cli, moq-relay, moq-token-cli (moq-gst's workflow has no PR dry-run, so its fix is exercised only on the next moq-gst-v* tag).

https://claude.ai/code/session_015J5tVAQ7ESjBhnzdeXfhgX

@kixelated kixelated marked this pull request as ready for review May 23, 2026 21:13
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 23, 2026

Review Change Stack

Walkthrough

This PR updates the packaging workflows for moq-cli, moq-gst, moq-relay, and moq-token-cli to apply consistent templating behavior. Both Debian and RPM packaging steps now render nfpm configuration files using envsubst to interpolate environment variables (VERSION, ARCH, BINARY_PATH, and others depending on the package) into /tmp/nfpm.yaml before passing the rendered file to nfpm pkg. RPM builds additionally adopt dnf install --allowerasing during container dependency installation to enable package replacement when needed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes replacing Docker RPM builds with cargo zigbuild, but the primary change (emphasized in the PR description and objectives) is adding envsubst pre-rendering for nfpm config files. The title does not reflect the main fix. Update the title to better reflect the primary change: 'ci: pre-process nfpm configs with envsubst' or similar, as the envsubst fix is the blocking issue being solved in this PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description comprehensively explains both the envsubst pre-rendering fix and the cargo zigbuild optimization, detailing the root cause, solution, and testing approach related to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/nfpm-env-template
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/nfpm-env-template

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kixelated kixelated force-pushed the claude/nfpm-env-template branch from 72a25b9 to 4b26f34 Compare May 23, 2026 21:20
@kixelated kixelated changed the title packaging: use Go template syntax for env vars in nfpm contents packaging: pre-process nfpm config with envsubst May 23, 2026
The .rpm packaging steps used to rebuild each crate inside an
AlmaLinux 9 container (moq-cli/relay/token-cli) or Debian 12 + AlmaLinux 9
containers (moq-gst), purely to link against an older glibc. The
docker path was slow (~7-15 min per matrix entry, no cargo cache, fresh
rustup install), fragile (curl-minimal/dnf conflicts, network flakiness),
and easy to break invisibly because the build dies before the cargo
compile even starts.

Replace it with cargo-zigbuild against a glibc-pinned target
(`<triple>.2.34`). One cargo build per arch yields a single binary that
satisfies Debian 12+, Ubuntu 22.04+, RHEL/Rocky/Alma 9+ and Fedora.
The .deb and .rpm steps now point nfpm at the same artifact instead of
producing a separate rpm-build copy. Drops ~150 lines of workflow YAML
and the docker dependency.

For moq-gst the deb and rpm jobs collapse into a single `package` job
that runs once per arch on ubuntu-24.04 (which ships GStreamer 1.24,
satisfying gstreamer-rs 0.23's >= 1.22 headers requirement). The
resulting .so still dynamic-links to the host's libgstreamer-1.0.so.0,
matching the existing nfpm depends of gst >= 1.22.

Wiring:
- `cargo-zigbuild` and `zig` added to the .#packaging derivation so
  CI and local `nix develop` users share the same toolchain.
- `gettext` (envsubst) joins the derivation. The release workflows
  render nfpm.yaml templates with envsubst before invoking nfpm pkg,
  because nfpm's ${VAR}/{{ .Env.VAR }} expansion is only honored for
  a small allow-list of top-level fields and never for contents[].src.
- nfpm.yaml `libc6` depends drop from >= 2.35/2.36 to >= 2.34 to
  match the zigbuild floor.

https://claude.ai/code/session_015J5tVAQ7ESjBhnzdeXfhgX
@kixelated kixelated force-pushed the claude/nfpm-env-template branch from b14e44f to 18664d0 Compare May 23, 2026 21:40
@kixelated kixelated changed the title packaging: pre-process nfpm config with envsubst ci: replace docker .rpm builds with cargo zigbuild May 23, 2026
@kixelated kixelated merged commit 87c5220 into main May 23, 2026
14 checks passed
@kixelated kixelated deleted the claude/nfpm-env-template branch May 23, 2026 23:03
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.

2 participants