Skip to content

feat(gateway): distribute verified native release binaries - #2790

Merged
hidb4ai merged 5 commits into
oceanbase:masterfrom
hidb4ai:codex/gateway-distribution
Nov 23, 2026
Merged

hidb4ai merged 5 commits into
oceanbase:masterfrom
hidb4ai:codex/gateway-distribution

Conversation

@hidb4ai

@hidb4ai hidb4ai commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Related to the PowerContext 1.6.0 release preparation in #2783 and Gateway RFC #2199.

Rationale for this change

Gateway users currently need a Rust toolchain and a source checkout. This adds verified native downloads to the same PowerContext GitHub Release so users can run pc-gateway directly. Docker image distribution remains out of scope.

What changes are included in this PR?

  • Build Linux x86_64/arm64 and macOS Intel/Apple Silicon archives from the exact resolved release commit with Rust 1.95.0 and locked dependencies. Manual builds produce candidate Actions artifacts only; ordinary PRs and branch pushes do not run the distribution workflow. The release workflow calls the build and published-download verification jobs.
  • Build Linux archives with pinned cargo-zigbuild 0.24.1 and Zig 0.15.2, explicitly targeting glibc 2.28. Reject binaries referencing newer glibc symbols and separate build caches by runner, target and linker configuration.
  • Add --version / -V and --help / -h, available without Core or configuration. Official binaries embed the release version, full source SHA and unsuffixed Rust target; the Cargo crate version remains independent.
  • Package the executable, binary-hash/identity manifest, license and installation pointer. Include per-archive SHA256 files, a complete four-platform manifest and checksum catalog. Reject missing platforms, mismatched identities, corrupted archives and unsafe members before publication/extraction.
  • Run each unpacked binary against a real disposable SQLite Core, checking Server identity, capabilities, proxying and separate Core/Gateway authentication. Both native Linux architectures additionally run the Gateway in a digest-pinned Rocky Linux 8 container with glibc 2.28, connected to Core on the runner over UDS. Published downloads undergo the same checks.
  • Upload release assets only after all four builds pass. Add matching English/Chinese installation, configuration, upgrade and release-maintainer documentation.

Are there any user-facing changes?

Archives use powercontext-gateway-<version>-<rust-target>.tar.gz under the PowerContext release tag. Linux binaries require glibc 2.28+; their builds and native smoke checks run on Ubuntu 22.04. The Rocky Linux 8 checks validate older userspace on both native architectures, while sharing the runner's kernel. They do not establish compatibility with historical kernels or an entire older distribution.

macOS binaries target macOS 15+ and are unsigned and not notarized. Core's Python/SQLite requirements and provider CLI requirements are separate from the Gateway's glibc baseline. Core and provider CLIs remain separately installed.

There are no native Windows archives or container images in this change. Windows still requires Unix transport and shutdown portability work; the guide describes running the Linux package inside WSL2 and distinguishes this from native Windows support and WSL2 host acceptance.

This PR does not change model request handling, database schemas or migration identities. It must merge before creating a release tag that should contain Gateway assets. Rerunning an older tag without this workflow does not backport distribution support.

Core smoke checks use uv-managed Python with a checked SQLite 3.38+ runtime and emit subprocess diagnostics on failure.

How was this change tested?

The candidate validation workflow checks out source commit 32b8bb27ada453347324de608588989f7a64b62a. Its temporary launcher is outside this PR; it calls the distribution workflow and produces candidate artifacts without publishing release assets.

  • Both native Linux jobs passed release compilation, packaging/unpacking, identity and glibc-symbol checks, native real-Core smoke and Rocky Linux 8 real-Core smoke.
  • The native macOS Intel build, archive verification and real-Core smoke passed. Apple Silicon execution and the complete four-platform catalog check are pending.
  • uv run prek run -a, including Ruff and full type checks, passed on the pinned source in CI.
  • uv run pytest tests/test_gateway_distribution.py tests/test_ci_pipeline.py tests/test_workflow_actions.py -q: 85 passed locally and in CI. Archive round-trip checks cover the glibc 2.28 metadata for both Linux targets.
  • actionlint passed for the distribution and release workflows. Documentation command syntax, bilingual command consistency and relative links were checked.

These checks cover real SQLite Core startup, identity, proxying and authentication without model-provider calls. Published-attachment download verification requires release execution. No release assets have been published.

AI usage statement

OpenAI Codex assisted with the implementation, documentation and validation.

@jasper-yl

Copy link
Copy Markdown
Contributor

@hidb4ai Thanks for lowering the Linux baseline to glibc 2.35 in 5699be8. Here is a measurement that could take it further without tying the baseline to the runner image.

2.35 still excludes RHEL/Rocky/Alma 9 and Amazon Linux 2023 (glibc 2.34), and RHEL 8 / Debian 10 (2.28). Building with cargo-zigbuild and a glibc-versioned target sets the floor independently of the runner. I measured this on 311ffab with the pinned Rust 1.95.0. 5699be8 changes only the workflow and docs, so the Rust sources are the same.

Build Highest symbol required
cargo-zigbuild zigbuild --locked --manifest-path gateway/Cargo.toml --release -p pc-gateway-app --target x86_64-unknown-linux-gnu.2.17 GLIBC_2.17
same with --target aarch64-unknown-linux-gnu.2.17 (cross-built on x86_64) GLIBC_2.17

The x86_64 binary passed this PR's own tests/e2e/gateway_distribution_smoke.py on every environment below. Core ran on the host; the binary ran inside each container through a wrapper sharing host networking and /tmp for the Core socket.

Environment glibc --version + smoke test
centos:7 2.17 passed
rockylinux:9 2.34 passed
ubuntu:22.04 2.35 passed
debian:12 2.36 passed
Ubuntu 24.04 host, no container 2.39 passed
debian:13, ubuntu:25.04, fedora:42 2.41 passed
ubuntu:25.10, fedora:43 2.42 passed
archlinux:latest 2.44 passed

The aarch64 binary passed the same smoke test under qemu user emulation on centos:7 and ubuntu:22.04.

Suggestion for the two Linux jobs:

  • Install zig and cargo-zigbuild, then build with cargo +1.95.0 zigbuild … --target <target>.<glibc>. cargo-zigbuild strips the suffix, so the binary stays at gateway/target/<target>/release/pc-gateway and your new "Check Linux glibc baseline" step works unchanged with a lower bound.
  • A floor such as 2.28 covers RHEL 8+ and Debian 10+. 2.17 also ran here, but containers share the host kernel, so these runs do not cover very old kernels (CentOS 7 ships 3.10).

For a later Windows change, if useful: a cross-build to x86_64-pc-windows-gnu compiled 155 crates, including ring, rustls, tokio, hyper, reqwest and the other gateway crates. It stopped at pc-gateway-core/src/uds_gate_client.rs, which imports tokio::net::UnixStream unconditionally. pc-gateway-app/src/proxy.rs and shutdown.rs were not reached by the compiler.


@hidb4ai 感谢在 5699be8 里把 Linux 基线降到 glibc 2.35。这里补充一组实测数据,或许能把门槛再降一些,同时让基线不再依赖 runner 镜像。

2.35 仍然排除了 RHEL/Rocky/Alma 9 和 Amazon Linux 2023(glibc 2.34),以及 RHEL 8 / Debian 10(2.28)。改用 cargo-zigbuild 并在 target 上指定 glibc 版本,就可以在任何 runner 上构建出固定基线的二进制。以下数据基于 311ffab 和锁定的 Rust 1.95.0 实测;5699be8 只改了 workflow 和文档,Rust 源码没有变化。

构建方式 二进制最高要求的符号版本
cargo-zigbuild zigbuild --locked --manifest-path gateway/Cargo.toml --release -p pc-gateway-app --target x86_64-unknown-linux-gnu.2.17 GLIBC_2.17
同上,改为 --target aarch64-unknown-linux-gnu.2.17(在 x86_64 上交叉编译) GLIBC_2.17

x86_64 二进制在下表所有环境中都通过了本 PR 自带的 tests/e2e/gateway_distribution_smoke.py:Core 运行在主机上,二进制通过包装脚本在各容器内运行,与主机共享网络,并共享 /tmp 以便访问 Core 的 socket。

环境 glibc --version + 冒烟测试
centos:7 2.17 通过
rockylinux:9 2.34 通过
ubuntu:22.04 2.35 通过
debian:12 2.36 通过
Ubuntu 24.04 主机(不经过容器) 2.39 通过
debian:13、ubuntu:25.04、fedora:42 2.41 通过
ubuntu:25.10、fedora:43 2.42 通过
archlinux:latest 2.44 通过

aarch64 二进制在 qemu 用户态模拟下,centos:7 和 ubuntu:22.04 也都通过了同一冒烟测试。

对两个 Linux 任务的建议:

  • 安装 zig 和 cargo-zigbuild,用 cargo +1.95.0 zigbuild … --target <target>.<glibc> 构建。cargo-zigbuild 会去掉版本后缀,产物仍在 gateway/target/<target>/release/pc-gateway,新增的 "Check Linux glibc baseline" 步骤只需调低下限,其余不用改。
  • 下限可以选 2.28 这类版本,覆盖 RHEL 8+ 和 Debian 10+。2.17 在这里也能运行,但容器共用主机内核,所以这些测试覆盖不到很老的内核(CentOS 7 自带 3.10)。

以后做 Windows 支持时供参考:交叉编译到 x86_64-pc-windows-gnu,155 个 crate 都编译通过了,包括 ring、rustls、tokio、hyper、reqwest 和网关的其他 crate。编译停在 pc-gateway-core/src/uds_gate_client.rs,它无条件引入了 tokio::net::UnixStream。pc-gateway-app/src/proxy.rs 和 shutdown.rs 这次编译没走到。

@hidb4ai hidb4ai added the 1.6.0 v1.6.0 release tracking label Nov 23, 2026
@hidb4ai
hidb4ai merged commit d2d6020 into oceanbase:master Nov 23, 2026
181 of 185 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6.0 v1.6.0 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants