Skip to content

feat(build): add musl binaries for Alpine Linux support#762

Draft
BYK wants to merge 1 commit intomainfrom
feat/musl-binaries
Draft

feat(build): add musl binaries for Alpine Linux support#762
BYK wants to merge 1 commit intomainfrom
feat/musl-binaries

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 16, 2026

Summary

Closes #754

  • Add sentry-linux-x64-musl and sentry-linux-arm64-musl native binaries using Bun's built-in musl cross-compilation targets
  • Add runtime musl detection so the install script and self-upgrade download the correct binary variant
  • Add Alpine Docker smoke test in CI to verify musl binaries work

Changes

Build system (script/build.ts): Extend BuildTarget with libc?: "musl", add 2 musl entries to ALL_TARGETS, update getPackageName/getBunTarget/parseTarget to handle musl suffix.

Runtime detection (src/lib/binary.ts): New isMusl() function checks for /lib/ld-musl-<arch>.so.1 (fast stat) with ldd --version fallback. getPlatformBinaryName() appends -musl on musl systems — auto-propagates to upgrade and download URLs.

Install script (install): detect_musl function with same two heuristics. libc_suffix applied to both nightly (GHCR) and stable (GitHub Releases) download paths. libc tag added to error telemetry.

CI (.github/workflows/ci.yml): linux-x64-musl and linux-arm64-musl added to full build matrix (cross-compiled on ubuntu-latest). Alpine Docker smoke test for x64-musl.

No changes needed to .craft.yml (regex already matches), Homebrew formula (correctly excludes musl), or downstream consumers of getPlatformBinaryName().

Add linux-x64-musl and linux-arm64-musl native binaries using Bun's
built-in musl cross-compilation targets. This enables the curl installer
and self-upgrade to work on Alpine Linux and other musl-based systems.

Build system (script/build.ts):
- Extend BuildTarget with optional libc field
- Add musl entries to ALL_TARGETS (7 targets, up from 5)
- Update getPackageName/getBunTarget/parseTarget for musl suffix

Runtime detection (src/lib/binary.ts):
- Add isMusl() with two heuristics: ld-musl linker check and ldd output
- getPlatformBinaryName() now returns -musl suffix on musl systems
- Auto-propagates to upgrade, delta-upgrade, and download URLs

Install script:
- Add detect_musl function with same heuristics
- Apply libc_suffix to both nightly (GHCR) and stable (GitHub) downloads
- Include libc tag in error telemetry

CI (.github/workflows/ci.yml):
- Add linux-x64-musl and linux-arm64-musl to full build matrix
- Add Alpine Docker smoke test for linux-x64-musl

No changes needed to .craft.yml (regex already matches), Homebrew
formula (correctly excludes musl), or downstream consumers of
getPlatformBinaryName().
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (build) Add musl binaries for Alpine Linux support by BYK in #762
  • (init) Pre-supply existingSentry to eliminate roundtrip by betegon in #755

Bug Fixes 🐛

  • (arg-parsing) Normalize spaces in slugs and trim whitespace in issue IDs (CLI-14M, CLI-16M) by BYK in #757
  • (search) Rewrite OR queries to in-list syntax across all --query commands (CLI-16J) by BYK in #758
  • (upgrade) Retry spawn on EBUSY for Windows Defender file locking (CLI-16E) by BYK in #756

Internal Changes 🔧

  • (time-range) Parse --period at flag level via parsePeriod by BYK in #760
  • Regenerate docs by github-actions[bot] in 34bf056d

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-762/

Built to branch gh-pages at 2026-04-16 08:36 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 82.14%. Project has 1638 uncovered lines.
❌ Project coverage is 95.44%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/binary.ts 82.14% ⚠️ 5 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.45%    95.44%    -0.01%
==========================================
  Files          236       236         —
  Lines        35923     35950       +27
  Branches         0         0         —
==========================================
+ Hits         34290     34312       +22
- Misses        1633      1638        +5
- Partials         0         0         —

Generated by Codecov Action

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.

Feature Request: Provide musl binaries for Alpine Linux support

1 participant