Repository navigation
Provide signed macOS artifacts - #115169
Conversation
8d6af43 to
04edf4a
Compare
|
Workflow [PR], commit [7eda646] Summary: ✅ AI ReviewSummaryThis PR adds Linux-based signing and notarization for the release-branch macOS binaries, then teaches Findings
Final VerdictNeeds changes before merge. |
The probe answered the question that was blocking this: public CI *can* sign, on `amd-release-maker`. Its instances assume `ec2_admin` - the same identity as the private fleet - and a real `kms:Sign` against the Developer ID key succeeded there, so no IAM grant is needed after all. https://github.com/ClickHouse/ClickHouse/actions/runs/32055437965 ``` arn:aws:sts::542516086801:assumed-role/ec2_admin/i-0fac39d5fd7d64ba3 kms:DescribeKey -> Enabled, RSA_2048, SIGN_VERIFY kms:Sign -> RSASSA_PKCS1_V1_5_SHA_256 ``` That pool exists to serve `CreateRelease`, so point the sign jobs at it and take them out of `MasterCI`. Signing every master commit would put dozens of runs a day on a pool sized for releases, and nothing consumes a signed master binary: the only consumer that needs a signature is a release asset, which is what the Homebrew cask installs. `ReleaseBranchCI` already carries the jobs, and its cadence matches the pool. The default pools stay unable to sign - they assume `untrusted_runner`, which has no KMS access, and it must stay that way because the same role serves pull request pools. Related: #115169 Co-Authored-By: Claude Opus 5 <[email protected]>
The validation workflow signed `arm_darwin` only. The Homebrew cask ships intel as well, and Apple issues a notarization ticket per `cdhash` per architecture, so `amd_darwin` needs its own signature and its own submission. Build and sign both. The identity assertions were weaker than they looked. `rcodesign print-signature-info` emits an `apple_team_id` line per certificate in the chain - the intermediate reports `G2`, the root `Apple Certification Authority` - so a grep over the whole output would have accepted a signature made with a foreign leaf. Assert the first line instead, the chain being embedded leaf first, and check the leaf subject of the committed chain file alongside the existing public-key comparison against KMS. Related: #115169 Co-Authored-By: Claude Opus 5 <[email protected]>
c3e6b83 to
7bcd2f3
Compare
The image provides tooling to sign and notarize macOS binaries from Linux: `rcodesign` built with the `pkcs11` feature, the `aws-kms-pkcs11` module pinned by release tag and `sha256`, and `p11-kit`. The signing key stays in AWS KMS. It derives from `clickhouse/fasttest`, like `clickhouse/binary-builder` and `clickhouse/cctools`. AMD only. No job uses the image yet. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`clickhouse/macos-signer` does not exist on Docker Hub and the CI robot lacks the
scope to create it on push, so the manifest merge failed with:
ERROR: pull access denied, repository does not exist or may require
authorization: server message: insufficient_scope: authorization failed
`clickhouse/utils` already exists and is empty, so it needs no new repository. A
general-purpose name also suits an image that carries standalone tooling rather
than only the signing tools.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The published macOS binaries are unsigned, so a browser download is quarantined and Gatekeeper refuses to run it. The Homebrew cask disables itself on 2026-09-01 for exactly this reason. The darwin builds now also provide the plain (not self-extracting) Mach-O, because a self-extracting archive cannot carry a signature - signing it would discard the payload. A job then signs that binary with `rcodesign`, using a Developer ID certificate whose key lives in AWS KMS and is used for one RSA operation, so no key material ever reaches the runner, and submits the result to Apple's Notary API from Linux - no macOS runner is involved anywhere. The hardened runtime is mandatory for notarization and kills unsigned executable memory, which ClickHouse's regexp JIT allocates, hence `com.apple.security.cs.allow-unsigned-executable-memory` in the entitlements. Signing runs on `amd-release-maker` in `ReleaseBranchCI` only: that pool's identity is the only one that can reach the key, and a release asset is the sole consumer of a signature. Nothing is published yet - the signed zip is a CI artifact. Co-Authored-By: Claude Opus 5 <[email protected]>
7bcd2f3 to
6b1caac
Compare
`CreateRelease` now also downloads the signed, notarized zip each sign job uploads and attaches it to the GitHub release as `clickhouse-macos.zip` and `clickhouse-macos-aarch64.zip`, alongside the existing self-extracting binaries rather than replacing them. Two knock-on changes. The sign jobs lose `allow_failure`, because a release now needs their output. And their cache digest gains the build digest paths: it previously hashed only the signing script and certificate, so on a release branch every commit after the first would hit the cache, upload nothing under its own SHA, and leave every commit unreleasable - `release_build_artifacts_ready` requires the exact object key per commit. Co-Authored-By: Claude Opus 5 <[email protected]>
One consumer, and `ci/workflows/create_release.py` already writes the label list literally. Co-Authored-By: Claude Opus 5 <[email protected]>
Tools, then committed inputs, then working files, then KMS, then the Apple identity, then the notary credentials. Pure reordering. Co-Authored-By: Claude Opus 5 <[email protected]>
Job assets live in `ci/jobs/scripts/<area>/` - `clickbench/create.sql`, `fuzzer/fuzz-server-settings.xml`, `docker_server/config.sh`. `ci/signing` was the only asset directory at the top of `ci/`, where everything else is infrastructure. Co-Authored-By: Claude Opus 5 <[email protected]>
Access is settled, and the `sign` step reports the same permission error on its own. The probe also issued a real `kms:Sign` of a dummy message on every run, doubling the signature count in CloudTrail. Co-Authored-By: Claude Opus 5 <[email protected]>
| for job in JobConfigs.special_build_jobs | ||
| if any(t in job.name for t in ("darwin",)) | ||
| ], | ||
| *JobConfigs.sign_macos_binary_jobs, |
There was a problem hiding this comment.
The workflow now publishes CH_*_DARWIN_SIGNED, but nothing in ReleaseBranchCI ever consumes those artifacts on a macOS runner before CreateRelease ships them. The Linux-side checks in sign_macos_binary.py prove that rcodesign and the notary service accept the archive, but they do not prove the hardened-runtime binary still starts on macOS or that the allow-unsigned-executable-memory entitlement is sufficient for ClickHouse's JIT paths.
Please add a minimal macOS smoke job that downloads the signed zip and runs at least clickhouse local --query 'SELECT 1' plus a regexp/JIT query before making patch releases depend on this output.
`ReleaseBranchCI` is a `push` workflow, so a release branch runs its own workflow definition, while `AutoReleases` and `CreateRelease` run from `master`. Release branches cut before signing existed never upload the zips, so demanding them unconditionally would reject every candidate commit on 25.8, 26.3, 26.5, 26.6 and 26.7 and block their patch releases. Read the requirement off the release commit instead: `commit_has_macos_signing` asks git whether that commit's tree carries the signing job. It raises when the commit is not present locally rather than assuming no signing, which would silently publish a release without its signed assets. Co-Authored-By: Claude Opus 5 <[email protected]>
| yield package_arch, sign_macos_job_name(package_arch) | ||
|
|
||
|
|
||
| def commit_has_macos_signing(commit_sha: str) -> bool: |
There was a problem hiding this comment.
commit_has_macos_signing is using the presence of ci/jobs/sign_macos_binary.py as the proxy for "this release commit uploads sign_macos_binary_*_darwin/clickhouse-macos.zip". That is an implementation detail, not the contract.
Because AutoReleases and CreateRelease run from master against older release-branch commits, a selective backport or a later master-only rename/move of this helper makes the gate return the wrong answer: false positives block patch releases waiting for artifacts that can never exist, and false negatives silently stop publishing the signed macOS assets.
This needs an explicit, stable marker for the release-asset contract (or another direct proof of signed-zip production), not a helper-script path.
`ci/tests/` runs where the workspace is not a usable git repository - `git rev-parse HEAD` exits 128 - so the test cannot read a real commit's tree. Patch `commit_has_macos_signing` instead and drive both shapes, with and without the signed zips. Co-Authored-By: Claude Opus 5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units7 translation units recompiled, 14 s compile time in total, 7 of them have a recent master baseline. |
|
|
||
| sign_macos_binary_jobs = Job.Config( | ||
| name=JobNames.SIGN_MACOS, | ||
| runs_on=["self-hosted", "amd-release-maker"], |
There was a problem hiding this comment.
Can we use a standard runner? style-cheker-aarch64?
|
|
||
| PROBE_BRANCH = "macos-signing-public" | ||
|
|
||
| workflow = Workflow.Config( |
There was a problem hiding this comment.
This leaves a permanent push workflow in master that mounts SECRETS and performs real kms:Sign probes against the production macOS-signing key on a fixed branch name. That widens the signing-key surface beyond the actual release path: any future push to macos-signing-public will re-enable it.
The current head already shows this is not hypothetical: the KMSProbe report for 18709c2e has amd-small, amd-medium, amd-large, and style-checker all OK. If this workflow is only temporary runner telemetry, it should not merge as a normal push trigger. Please drop it before merge, or convert it to a maintainer-only workflow_dispatch path with non-production credentials.
Every unprefixed amd pool assumes `ec2_admin` and completed a real `kms:Sign`: `amd-small`, `amd-medium`, `amd-large` and `style-checker`. Only pull request pools carry `untrusted_runner`, which is why yesterday's `pr-amd-small` probe reported no access. https://github.com/ClickHouse/ClickHouse/actions/runs/32141517638 Signing is light - fetch an artifact, one KMS signature, then wait on Apple - so it belongs on the cheapest pool, and the release pool stays clear for releases. Co-Authored-By: Claude Opus 5 <[email protected]>
18709c2 to
7eda646
Compare
|
|
||
| def __init__(self, release, commit_sha, version): | ||
| assert version.startswith(release), "Invalid release branch or version" | ||
| with_signed_macos = release_packages.commit_has_macos_signing(commit_sha) |
There was a problem hiding this comment.
CreateRelease is treating commit_has_macos_signing as a plain boolean, but in the actual release pipeline that helper runs after release_job.py has converted the checkout into a treeless partial clone. git cat-file <commit>:ci/jobs/sign_macos_binary.py may therefore need a lazy fetch of the commit's tree, and any transient fetch/auth failure currently becomes False here.
That means this step can publish a release without clickhouse-macos.zip / clickhouse-macos-aarch64.zip instead of failing closed. Please make the probe raise on lookup errors and return False only when it can positively prove the path is absent, or replace it with an explicit signed-assets contract marker.
Keep only the producing side: the sign jobs, the plain darwin artifact, the `clickhouse/utils` image and the signing assets. 26.7 has none of the release tooling this PR also touched - `release_packages.py`, `auto_release_job.py` and its test do not exist there - and `CreateRelease` runs from `master` anyway, so publishing needs nothing on this branch. Left `create_release.py` at the 26.7 version too: the auto-merge had inserted calls to `release_packages`, which would have raised `NameError` on every 26.7 release. Co-Authored-By: Claude Opus 5 <[email protected]>
Cherry pick #115169 to 26.7: Provide signed macOS artifacts
Backport #115169 to 26.7: Provide signed macOS artifacts
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Provide signed artifacts for macOS.
Workflow [PR]
Sync PR [sync-upstream/pr/115169]
Version info
26.8.1.1640(included in26.8and later)26.7.4.57