Skip to content

ci(cli-release): build Linux binaries at glibc 2.17 (manylinux2014 + python-build-standalone) - #48

Merged
omarsy merged 5 commits into
mainfrom
fix/cli-release-glibc-baseline
Jun 6, 2026
Merged

omarsy merged 5 commits into
mainfrom
fix/cli-release-glibc-baseline

Conversation

@omarsy

@omarsy omarsy commented Jun 6, 2026 •

Copy link
Copy Markdown
Member

Problem

Operators on non-latest Linux distros can't run the installed binary:

[PYI-...:ERROR] Failed to load Python shared library '.../_internal/libpython3.11.so.1.0':
/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found

The linux-* assets are built on ubuntu-22.04 (glibc 2.35). PyInstaller links the bundled libpython — and every shared lib it pulls in — against the build host's glibc, and glibc is backward- but not forward-compatible, so the binary aborts at startup on anything older.

Fix — one binary per arch at the glibc 2.17 floor

A glibc-2.17 binary runs on everything (backward compat: the lowest floor covers all higher), so no need to ship multiple glibc variants:

Distro glibc Before After
Ubuntu 22.04+/Debian 12 2.35+ ✅ ✅
Ubuntu 20.04 / Debian 11 2.31 ❌ ✅
RHEL/Rocky/Alma 8 & 9 2.28 / 2.34 ❌ ✅
Amazon Linux 2 2.26 ❌ ✅
CentOS 7 2.17 ❌ ✅

2.17 means manylinux2014, which forces two changes vs a plain job container:

  1. node20 (v4 actions' runtime) needs glibc ≥ 2.28 → manylinux2014 can't be a job container:. checkout + upload stay on the host; only the build runs via docker run in the container.
  2. manylinux2014 is CentOS 7 based, no shared-libpython python3.11 (PyInstaller needs a shared libpython) → fetch a relocatable one from python-build-standalone.

macOS / Windows jobs unchanged (native build, gated on !matrix.image).

Hardening (third commit)

Because the build now downloads a third-party interpreter, the PBS path is hardened:

  • Integrity — verify the tarball against a hard-pinned per-arch sha256 before extracting (the release ships no sidecar, so the hash is computed at pin time and lives in the matrix). Aborts if the asset ever changes.
  • Resilience — portable download retry loop (manylinux2014's curl 7.29 lacks --retry-all-errors).
  • Verification — a static guard fails the build if any bundled .so references a symbol newer than GLIBC_2.17, and the freshly built binary is booted inside a real centos:7 (glibc 2.17) container so CI proves it runs on the oldest supported glibc.

Validation (native aarch64, real CLI)

  • poetry install --with release, 91 tests pass, pyinstaller greffer.spec bundles libpython3.11.so.1.0 ✅
  • sha256sum -c passes on the real asset, rejects a tampered hash ✅
  • floor guard reports GLIBC_2.17; every bundled .so references only GLIBC_2.17 ✅
  • greffer --help runs under centos:7 ✅

The PR's own pull_request CI exercises the real native x86_64 + arm64 matrix.

Notes

  • Three commits: manylinux_2_28 (2.28) → superseded by manylinux2014 (2.17) → hardening. Squash on merge.
  • PBS is pinned (tag + sha256); bump pbs_url + pbs_sha256 together for CPython security updates.
  • The published release stays the broken 2.35 binary until a new cli-v* tag is cut.

🤖 Generated with Claude Code

omarsy and others added 2 commits June 6, 2026 16:44
…loor)

The linux-x86_64 / linux-arm64 binaries were built on ubuntu-22.04
(glibc 2.35). PyInstaller links the bundled libpython against the build
host's glibc, and glibc is backward- but not forward-compatible, so the
binary aborts at startup on any older host:

    libpython3.11.so.1.0: /lib/x86_64-linux-gnu/libm.so.6:
    version `GLIBC_2.35' not found

That breaks every non-latest distro — RHEL/Rocky/Alma 8 & 9 (2.28/2.34),
Ubuntu 20.04 / Debian 11 (2.31), and more.

Build the two Linux targets inside a manylinux_2_28 container instead, so
the binaries get a glibc 2.28 floor. manylinux_2_28 is the lowest glibc
that still satisfies node20 (the v4 actions' runtime), so it works as a
plain job `container:` with no docker-run rework. macOS/Windows jobs are
unchanged (container is empty for those matrix entries).

manylinux's own /opt/python is static (Py_ENABLE_SHARED=0), which
PyInstaller can't bundle, so the container step installs the AlmaLinux 8
shared-libpython python3.11 via dnf (+ python3.11-pip, shipped
separately) and pins Poetry's venv to it.

Validated end-to-end in the aarch64 container against the real CLI:
91 tests pass, pyinstaller bundles libpython3.11.so.1.0, `greffer --help`
runs, and the bundled libpython's max referenced symbol is GLIBC_2.28.

Excludes only CentOS 7 / Amazon Linux 2 (glibc < 2.28, both EOL); those
would require manylinux2014 + a docker-run-on-host build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ld-standalone)

Supersedes the manylinux_2_28 (glibc 2.28) approach to cover CentOS 7 and
Amazon Linux 2 as well — a single 2.17-floor binary per arch runs on
everything (backward compat: the lowest floor covers all higher), so
there's no need to ship multiple glibc variants.

2.17 means manylinux2014, which can't be a job `container:` (node20, the
v4 actions' runtime, needs glibc >= 2.28) and is CentOS-7 based with no
shared-libpython python3.11 (PyInstaller needs a SHARED libpython). So:
- checkout + upload stay on the host; only the build runs via `docker
  run` inside the container.
- a relocatable shared-libpython interpreter is fetched from
  python-build-standalone (pinned; bump periodically).

macOS / Windows jobs unchanged (native build, gated on !matrix.image).

Validated with the verbatim `docker run` command on native aarch64: 91
tests pass, pyinstaller bundles libpython3.11.so.1.0, the binary runs,
and every bundled .so references only GLIBC_2.17.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@omarsy omarsy changed the title ci(cli-release): build Linux binaries in manylinux_2_28 (glibc 2.28 floor) ci(cli-release): build Linux binaries at glibc 2.17 (manylinux2014 + python-build-standalone) Jun 6, 2026
omarsy and others added 3 commits June 6, 2026 17:07
…-2.17 boot test)

Three robustness fixes for the python-build-standalone download path:

- Integrity: verify the fetched interpreter tarball against a hard-pinned
  per-arch sha256 before extracting (the PBS release publishes no sidecar,
  so the hash is computed at pin time and lives in the matrix). Aborts the
  release if the asset ever changes.
- Resilience: wrap the download in a portable retry loop. manylinux2014
  ships curl 7.29 (CentOS 7), which lacks --retry-all-errors, so the loop
  is hand-rolled rather than relying on curl flags.
- Verification: in addition to the static "max bundled GLIBC symbol <=
  2.17" regression guard, actually boot the freshly built binary inside a
  centos:7 container (multi-arch, glibc 2.17 — the real floor) so CI
  proves it runs on the oldest supported glibc, not just that the symbols
  look right.

Validated on native aarch64: sha256 -c passes on the real asset and
rejects a bad hash, 91 tests pass, the floor guard reports GLIBC_2.17, and
greffer --help runs under centos:7.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adversarial review (release-engineering focus) found a release-blocking
ownership bug plus robustness gaps; all fixed:

- BLOCKER: PyInstaller runs as root in the container, so cli/dist/ was
  created root-owned on the bind mount and the host-side Package step
  (running as the unprivileged runner user) could not write the tarball
  into it — every Linux release would fail. Chown the cli/ subtree back
  to the host uid/gid (derived from the mount) at the end of the build;
  this also clears root-owned leftovers (caches, egg-info) that would
  break workspace cleanup on reused/self-hosted runners. Scoped to cli/
  so it always exists and skips the checkout-owned .git/ tree.
- Boot test now reuses the digest-pinned manylinux2014 image (glibc 2.17,
  on quay, already pulled, multi-arch) instead of Docker Hub's centos:7,
  removing an anonymous-pull-rate-limit flake that could fail a release.
- Pin both manylinux2014 images by digest (they build the shipped
  binary — part of the supply chain, like the sha256-pinned PBS asset).
- Download retry loop now fails explicitly when attempts are exhausted
  instead of relying on a later step tripping over the missing file; no
  misleading trailing sleep on the final attempt.
- glibc-floor guard asserts it actually inspected symbols, so an empty
  result can't pass as "clean".
- Gate the generic --help smoke-test to macOS/Windows; Linux relies on
  the dedicated glibc-2.17 boot test (which exercises the real floor).
- publish: assert all five target artifacts are present before cutting
  the release, so artifact-naming drift can't ship a silent subset.

Re-validated end-to-end on native aarch64 (full build, sha256, floor
guard, chown, 2.17 boot) and in isolation (retry exhaustion, empty-symbol
guard, target-presence check).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ncy, precise boot-test note

All minor, no behavior change to the build:
- Fix stale "four arches"/"four jobs" comments (the matrix builds five
  targets: linux x2, darwin x2, windows).
- Add a per-ref concurrency group (cancel-in-progress: false) so two
  quick pushes or a tag re-push can't run two publish jobs racing the
  same GitHub Release.
- Reword the boot-test comment: the image is digest-pinned per-arch (the
  matrix pins the matching aarch64/x86_64 digest), not a multi-arch index.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@omarsy

omarsy commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

Adversarial expert review — passed (4 rounds → CLEAN)

Ran an independent release-engineering reviewer (GitHub Actions / PyInstaller / glibc / manylinux / Docker-in-CI / supply-chain) in a loop until a clean pass:

  • Round 1 — 1 blocker, 1 major, 3 minor
    • Blocker: PyInstaller runs as root in the container → cli/dist/ was root-owned on the bind mount, so the host-side Package step (unprivileged runner user) couldn't write the tarball into it → every Linux release would have failed. Fixed by chowning cli/ back to the host uid.
    • Major/minor: centos:7 boot test → Docker Hub rate-limit flake; retry-exhaustion failed silently; empty-symbol floor guard could pass vacuously.
  • Round 2 — 2 major, 2 minor: chown scope (named dirs vs whole tree; missing-build/ edge) → narrowed to /io/cli; root-owned leftovers breaking reused-runner cleanup; ungated smoke-test running on the wrong glibc; no all-targets-present check before publish.
  • Round 3 — 0 blocker/major, 3 minor: stale "four targets" comments, no concurrency: group, an imprecise "multi-arch" comment.
  • Round 4 — CLEAN, no regressions.

Every fix re-validated end-to-end on native aarch64 (full build, sha256, floor guard, chown, glibc-2.17 boot) and in isolation (retry exhaustion, empty-symbol guard, target-presence check).

Commits: manylinux_2_28 (2.28) → manylinux2014 (2.17) → hardening → review fixes → review nits. Squash on merge.

@omarsy

omarsy commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@omarsy
omarsy merged commit 922b2f4 into main Jun 6, 2026
6 checks passed
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