Files
Alexey MilovidovandClaude Opus 4.8 b030a5356f Address review: skip the merge-queue flaky check at config time for non-test PRs
The `SKIPPED` exit in `functional_tests.py` happens only after the job has been
scheduled, restored `CH_AMD_BINARY`, and entered the stateless-test container,
so a source-only PR still paid that startup cost even though there were no
stateless tests to rerun - breaking the "non-test PRs pay nothing" contract.

Add a minimal `workflow_filter_hooks` entry (`should_skip_merge_queue_job`) to
`MergeQueueCI` that filters the flaky check at config time when the PR changes
no stateless tests, so such a PR never schedules the runner. The hook is the
merge-queue counterpart to the `flaky` branch of `should_skip_job`, kept
deliberately minimal so it can never skip the build/style/fast-test jobs the
queue always needs. Its skip condition matches the in-job selection (both use
`Targeting.get_changed_tests`), so the config-time skip and the early exit never
disagree. A filtered job reports `SKIPPED`, which already counts as success for
the merge-ready status.

AI review: https://github.com/ClickHouse/ClickHouse/pull/110308

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-14 05:54:56 +00:00

48 lines
1.7 KiB
Python

from praktika import Workflow
from ci.defs.defs import DOCKERS, SECRETS, ArtifactConfigs, ArtifactNames
from ci.defs.job_configs import JobConfigs
from ci.jobs.scripts.workflow_hooks.filter_job import should_skip_merge_queue_job
workflow = Workflow.Config(
name="MergeQueueCI",
event=Workflow.Event.MERGE_QUEUE,
jobs=[
JobConfigs.style_check,
JobConfigs.fast_test,
*[job for job in JobConfigs.build_jobs if job.name == "Build (amd_binary)"],
# Reruns the PR's new/changed stateless tests against the merge group
# state, catching semantic conflicts with `master` changes that landed
# after the PR's last CI run (e.g. a new randomized setting in
# `tests/clickhouse-test`). Self-skips when the PR changes no tests.
*JobConfigs.stateless_tests_flaky_mq_jobs,
],
artifacts=[
*[
a
for a in ArtifactConfigs.clickhouse_binaries
if a.name == ArtifactNames.CH_AMD_BINARY
],
],
dockers=DOCKERS,
secrets=SECRETS,
enable_cache=True,
enable_report=True,
enable_cidb=True,
enable_merge_ready_status=True,
enable_commit_status_on_failure=True,
# Config-time skip for the stateless flaky check on PRs that change no
# stateless tests, so non-test PRs do not schedule the runner and restore
# the binary only for the job to self-skip inside `functional_tests.py`.
workflow_filter_hooks=[should_skip_merge_queue_job],
pre_hooks=[
"python3 ./ci/jobs/scripts/workflow_hooks/store_data.py",
"python3 ./ci/jobs/scripts/workflow_hooks/set_dummy_sync_commit_status.py",
"python3 ./ci/jobs/scripts/workflow_hooks/check_sync_pr_mergeable.py",
],
)
WORKFLOWS = [
workflow,
]