Skip to content

Support overriding the clickhouse binary with a PR build#988

Open
alexey-milovidov wants to merge 2 commits into
mainfrom
clickhouse-pr-binary-override
Open

Support overriding the clickhouse binary with a PR build#988
alexey-milovidov wants to merge 2 commits into
mainfrom
clickhouse-pr-binary-override

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

What

Adds a clickhouse_pr environment variable to the benchmark launcher. When set to a ClickHouse/ClickHouse pull-request number, the clickhouse* systems benchmark that PR's CI release build instead of the latest stable release. Every other system ignores it.

clickhouse_pr=81944 system=clickhouse ./run-benchmark.sh

How

  • clickhouse_pr is set on the operator side (run-benchmark.sh), threaded to the VM through cloud-init.sh.in, and consumed only by the clickhouse* install scripts.
  • A new shared helper, lib/download-clickhouse, replaces the inline curl https://clickhouse.com/ | sh in every clickhouse*/install. With no clickhouse_pr set it keeps the historical stable-download behaviour; with it set it resolves and downloads the PR build.
  • "The PR build" = the newest PR commit whose Build (<arch>_release) CI check finished successfully for the machine's architecture (amd/arm), then the raw self-extracting binary that build uploaded to S3:
    https://clickhouse-builds.s3.amazonaws.com/PRs/<PR>/<SHA>/build_<arch>_release/clickhouse
    
    Commits are walked newest-first, so a tip commit whose build is still running, failed, or was skipped falls back to the last commit that does have a finished build — i.e. "the last commit with a finished release build". Uses the GitHub API (honours an optional GITHUB_TOKEN); fails loudly with a clear message if no successful build exists.

Filtering results

The chosen PR is written to the log as a ClickHouse PR: line and parsed by sink.parser into a new results.clickhouse_pr column so PR-build runs can be filtered apart from normal results (empty on a normal run). It is intentionally left out of the published output JSON, so the website payload is unchanged.

Important

prepare-database.sql is the schema definition; the live sink needs a manual migration to pick up the new column. SQL is in the PR discussion / provided to the operator.

Scope

Touches the seven clickhouse* systems that download the universal binary: clickhouse, clickhouse-trash-schema, clickhouse-web, clickhouse-parquet{,-partitioned}, clickhouse-datalake{,-partitioned}. Leaves clickhouse-tencent (hardcoded PR build) and clickhouse-cloud (managed) alone.

Testing

  • Resolution dry-run against a real PR (#81944) for both amd and arm produced the correct, known-good S3 URL scheme.
  • Ran the actual helper end-to-end with wget stubbed: native arm and forced-x86_64amd both resolve correctly; no-clickhouse_pr falls back to the stable installer; missing-build case exits 1 with a clear message; candidate ordering is head-first, newest→oldest, deduped.
  • ClickHouse PR: extraction verified: 8194481944, empty → ''.
  • All touched scripts pass bash -n; cloud-init.sh renders and validates with and without the PR set; the sink.parser SELECT (18 cols) aligns with the sink.results table.

🤖 Generated with Claude Code

Add a `clickhouse_pr` env variable to the benchmark launcher. When set to a
ClickHouse/ClickHouse pull-request number, the clickhouse* systems benchmark
that PR's CI release build instead of the latest stable release; every other
system ignores it.

The value is set on the operator side (run-benchmark.sh), threaded to the VM
through cloud-init, and consumed only by the clickhouse* install scripts via a
new shared helper, lib/download-clickhouse. The helper resolves "the PR build"
as the newest PR commit whose `Build (<arch>_release)` CI check finished
successfully for the machine's architecture, then downloads the raw
self-extracting binary that build uploaded to S3:

    https://clickhouse-builds.s3.amazonaws.com/PRs/<PR>/<SHA>/build_<arch>_release/clickhouse

Walking commits newest-first (falling back past a tip whose build is still
running, failed, or was skipped) implements "the last commit with a finished
release build". With no clickhouse_pr set the helper keeps the historical
`curl https://clickhouse.com/ | sh` behaviour.

The chosen PR is recorded in the log as a `ClickHouse PR:` line and parsed into
a new results.clickhouse_pr column (prepare-database.sql) so PR-build runs can
be filtered apart from normal results later.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread lib/download-clickhouse Outdated
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