Skip to content

Fix bugfix validation failing due to git ownership check in Docker - #97014

Merged
alexey-milovidov merged 86 commits into
masterfrom
fix-bugfix-validation-git-ownership
Jun 13, 2026
Merged

alexey-milovidov merged 86 commits into
masterfrom
fix-bugfix-validation-git-ownership

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The find_master_builds function (introduced in Test bugfix validation against multiple build types #96868) runs git log origin/master inside Docker containers that run as root, but the repository is owned by the ubuntu user
  • Git's ownership check blocks the command, returning empty output, so no master commits are found and the job crashes with assert build_urls, "Could not find master builds in S3"
  • Add git config --global --add safe.directory before the git command, following the existing pattern in build_clickhouse.py and build_toolchain.py

Visible in #96351 CI failures:

  • Bugfix validation (functional tests): AssertionError: Could not find master builds in S3
  • Bugfix validation (integration tests): AssertionError: Could not find master builds in S3

Both caused by: fatal: detected dubious ownership in repository at '/home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse'

Supersedes the revert in #97011.

Changelog category (leave one):

  • CI Fix or improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix bugfix validation CI jobs failing due to git ownership check in Docker containers.

🤖 Generated with Claude Code


Note

Medium Risk
Changes CI bugfix validation execution flow (binary selection, repeated runs across build types, and result/status inversion), which could affect pass/fail behavior and runtime of critical validation jobs.

Overview
Bugfix validation CI is updated to download and test against multiple recent master binaries (amd_asan_ubsan, amd_tsan, amd_msan, amd_debug) by discovering a master commit with a complete artifact set in S3 and iterating runs per build type.

Functional and integration bugfix validation now labels results per build type, performs fatal-log checks per iteration, cleans logs between iterations (new ClickHouseProc.clean_logs), and exits early on the first failing build type to preserve diagnostics.

Result handling is hardened so bugfix validation does not invert statuses when ERROR/infrastructure conditions are present (including filtering synthetic Timeout results), and workflow hook data collection now stores master_commits for the upstream repo to support the S3 lookup.

Reviewed by Cursor Bugbot for commit 66b69f5. Bugbot is set up for automated code reviews on this repo. Configure here.

Version info

  • Merged into: 26.6.1.765

The `find_master_builds` function runs `git log origin/master` inside
Docker containers that run as root, but the repository is owned by the
`ubuntu` user. Git's ownership check blocks the command, returning empty
output, so no master commits are found and the job fails with
"Could not find master builds in S3".

Add `git config --global --add safe.directory` before the git command,
following the existing pattern in `build_clickhouse.py` and
`build_toolchain.py`.

#96351

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [75f7059]

Summary: ✅


AI Review

Summary

This PR reworks bugfix-validation CI so functional and integration jobs discover a recent master commit with complete AMD sanitizer/debug artifacts, run the changed tests across those master binaries, preserve infrastructure ERROR conditions through status inversion, and cache the new helper inputs. The previous inline findings I checked are addressed in the current code, and I did not find a new line-specific correctness issue to comment on.

Missing context / blind spots
  • ⚠️ The latest Praktika report for commit 75f70593f94f80f92b7be4250fa0de20ce47d032 still had Bugfix validation (functional tests) and Bugfix validation (integration tests) running when reviewed; completed results for those two jobs would close the main validation gap.
Tests
  • ⚠️ This PR is labelled pr-ci, so the current CI run exercises the bugfix-validation sanity path, but not the final bugfix-label status inversion path guarded by pr-bugfix / pr-critical-bugfix. A completed run on a bugfix-labelled PR, or a focused test/dry-run that proves FAIL, OK, ERROR, Timeout, and OOM in dmesg are classified as intended, would close that evidence gap.
Final Verdict

Status: ⚠️ Request changes

Minimum required action: wait for the current bugfix-validation functional and integration jobs to finish successfully, and provide evidence that the bugfix-labelled inversion path is exercised or tested.

alexey-milovidov and others added 4 commits February 15, 2026 19:04
…on-git-ownership

# Conflicts:
#	ci/jobs/functional_tests.py
#	ci/jobs/integration_test_job.py
In CI, the checkout is a shallow clone of the branch head, so
`git log origin/master` does not work reliably. Instead, fetch
recent master commits via the GitHub API in the Config Workflow
job (which already uses `gh`) and pass them through `Info` KV data.

This eliminates the need for `git config --global --add safe.directory`
workarounds and makes bugfix validation independent of git clone depth.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Two issues with bugfix validation:

1. Crashes (e.g. sanitizer errors) produce `ERROR` status, but the result
   inversion only handled `FAIL`↔`OK`. A crash that reproduces the bug
   was not recognized as successful validation.

2. In functional tests, server logs from all 5 build types were mixed
   together in the same directory, making it impossible to diagnose
   which build type caused a crash.

Fix: treat `ERROR` the same as `FAIL` in result inversion (both count as
bug reproduction), and save server logs to per-build-type directories
between iterations.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/functional_tests.py Resolved
alexey-milovidov and others added 8 commits February 16, 2026 18:27
Rewrite bugfix validation loops in both functional and integration tests
to exit early on the first build type that reproduces the bug. This:

- Avoids duplicate test names (known CI limitation)
- Preserves server logs for the failed build type so CHECK_ERRORS can
  analyze them
- Reduces false negatives from workspace pollution between runs

Also re-enable the CHECK_ERRORS stage for bugfix validation: it detects
crashes (sanitizer errors, FATAL messages) which are valid bug
reproductions. Combined with the previous commit that treats ERROR
status as successful reproduction, crashes are now properly validated.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…kHouse/ClickHouse into fix-bugfix-validation-git-ownership
…on-git-ownership

# Conflicts:
#	ci/jobs/functional_tests.py
@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 28, 2026
Comment thread ci/jobs/integration_test_job.py Resolved
alexey-milovidov and others added 2 commits March 30, 2026 07:45
…dling

- functional_tests.py: Run `CHECK_ERRORS` (fatal message checking) for each
  build type inside the bugfix validation loop, rather than once at the end.
  This ensures crashes detected in any build type's logs are caught even when
  logs are cleaned between builds. The outer `CHECK_ERRORS` stage is skipped
  for bugfix validation since it is handled per-build.

- integration_test_job.py: Mirror the primary run's infrastructure-error
  handling in the bugfix validation loop: call `_mark_infrastructure_errors`
  for each `bt_result_parallel`/`bt_result_sequential`, propagate `has_error`
  and `error_info`, and skip sequential tests on error.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/integration_test_job.py Resolved
alexey-milovidov and others added 4 commits March 30, 2026 12:13
Previously `find_master_builds` only probed the first build type
(`build_amd_asan`) and assumed the same SHA had all other required
build types. This could pick a master commit with a partial build set
(e.g. one sanitizer build failed or wasn't uploaded), causing later
`wget` calls to fail.

Now all entries in `BUGFIX_BUILD_TYPES` are checked with `curl -sfI`
before the SHA is accepted. If any artifact is missing, the function
continues to the next master commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/functional_tests.py Resolved
Master added the `Fast test (arm_darwin)` job and the PR's `job_configs.py`
moves bugfix validation to `pr-amd-medium`; regenerate `master.yml` and
`pull_request.yml` to match `ci/*.py`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/scripts/bugfix_validation.py Resolved
alexey-milovidov and others added 2 commits June 2, 2026 14:29
…digest correct in bugfix validation

Three correctness fixes for the multi-build-type bugfix validation flow,
addressing review feedback:

- `run_tests` now derives `--memory-limit` from the build type under test
  (`build_type`) rather than the job name. For bugfix validation the job
  name is `Bugfix validation (functional tests)`, so the `amd_asan_ubsan`
  run previously got the 5 GiB default instead of 10 GiB, and a master-side
  memory-limit failure would have been inverted as a reproduced bug.

- The per-build restart in the bugfix loop now uses a new server-only
  `ClickHouseProc.stop_server` instead of `terminate`. `terminate` tears
  down Redpanda/Kafka and resets the MinIO webhooks, which the loop did not
  restore, so a changed Kafka/MinIO test could pass under the first build
  type and spuriously "reproduce" a bug under later ones. `stop_server`
  stops only the server processes and leaves the auxiliary services up;
  `terminate` now delegates to it.

- The shared helper `ci/jobs/scripts/bugfix_validation.py` is added to the
  digest inputs of both bugfix validation jobs, so a later change to it
  invalidates the Praktika cache instead of leaving the jobs cached with
  stale behavior. It is added to the integration job's own digest (not the
  common integration config) to avoid affecting unrelated integration jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…on-git-ownership

# Conflicts:
#	ci/jobs/functional_tests.py
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged master (was 1135 commits behind and CONFLICTING).

The only conflict was in ci/jobs/scripts/../functional_tests.py run_tests: this branch made the clickhouse-test --memory-limit follow the binary under test (build_type) rather than Info().job_name, while master had since added the graceful --global_time_limit handling at the same spot. Resolved by keeping both — limit_source = build_type if build_type is not None else Info().job_name for the memory limit, and master's global_time_limit_arg block. Both build_type and global_time_limit were already present in the merged run_tests signature and at all call sites.

All other files (integration_test_job.py, bugfix_validation.py, clickhouse_proc.py, store_data.py, job_configs.py, pull_request.yml) auto-merged. All changed Python files parse, all review threads are resolved, and the pre-merge CI was green.

Comment thread ci/jobs/functional_tests.py Resolved
…lidation

In the per-build-type loop of bugfix validation, `CH.start` and
`CH.wait_ready` return `False` on failure but their return values were
ignored, so `clickhouse-test` ran even when the swapped-in binary
(e.g. `amd_tsan`/`amd_msan`) never became ready. The resulting
`Server died` `FAIL` rows would then be flipped by
`invert_bugfix_validation_status` into a successful reproduction, even
though the binary never started.

Check the restart result and, on failure, append an `ERROR` row and
stop before running tests for that build type. `ERROR` rows are
preserved (not inverted) by `invert_bugfix_validation_status`, so the
job correctly reports the run as inconclusive instead of a spurious
"bug reproduced".

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread ci/jobs/functional_tests.py Resolved
alexey-milovidov and others added 2 commits June 8, 2026 17:07
…ion build type

The downloaded master binaries are self-extracting: the real ELF is
decompressed in place on first invocation. The per-build-type loop swapped
the binary and immediately called `start`, which only waits 15s for the
pid file. A sanitizer binary takes longer than that to self-extract, so the
swap to `amd_tsan` timed out ("Server failed to start after switching to
the amd_tsan binary"), and a later `clickhouse local` racing the half-written
binary failed with `open: Is a directory`. Decompress synchronously right
after the swap - exactly as the install stage does via
`clickhouse-server --version` - so `start` runs an already-extracted binary.

`start` also wipes the server data directory (`run_path0`), so the MinIO log
tables, stateful data, and `system.zookeeper` config built once in the START
stage are gone after the restart. Re-create them per build type (the
auxiliary Kafka/MinIO services keep running across `stop_server`, so only
server-side state needs rebuilding). Otherwise a stateful changed test fails
only because `test.hits`/`datasets`/the auxiliary ZooKeeper row disappeared,
and the bugfix inverter reports that false failure as a successful bug
reproduction.

CI report: #97014

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Pushed 9c1ae840db5 (after merging master).

Root cause of the red bugfix-validation job (CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97014&sha=ec6e9f63011fb74db4bcab86208fdf820ff0b6b4&name_0=PR&name_1=Bugfix%20validation%20%28functional%20tests%29): the downloaded master binaries are self-extracting. The per-build-type loop swapped the binary and immediately called start, which only waits 15s for the pid file — too short for a sanitizer binary to self-extract — so the swap to amd_tsan timed out (Server failed to start after switching to the amd_tsan binary), and a later clickhouse local racing the half-written binary failed with open: Is a directory (which surfaced as the Scraping system tables failure). Fixed by decompressing synchronously right after the swap, as the install stage does via clickhouse-server --version. The same commit also rebuilds the server-side state (MinIO log tables, stateful data, system.zookeeper config) that start wipes from run_path0, addressing the Bugbot review thread.

The remaining failure test_refreshable_mat_view_replicated/test.py::test_circular_dependencies_survive_restart (max_t not unique) is the known flaky issue #106651, unrelated to this CI-infrastructure change.

Comment thread ci/defs/job_configs.py Resolved
alexey-milovidov and others added 2 commits June 10, 2026 06:17
…alidation

`extend_sub_results` recomputes the aggregate status from child rows
only, so a runner-level `ERROR` set by `FTResultsProcessor` (e.g.
`not s.success_finish`) with parsed `OK`/`FAIL` rows was erased by the
fatal-log row extension before `invert_bugfix_validation_status` could
check it, allowing a harness-level termination to be inverted to green.
Capture `is_error` before extending and restore the status afterwards,
for both the first build type and the per-build-type loop.

Co-Authored-By: Claude Fable 5 <[email protected]>
…validation digest

`bugfix_validation_ft_pr_job` is not derived from `common_ft_job_config`
and did not include `ci/jobs/scripts/clickhouse_proc.py` in its cache
digest, even though the bugfix-validation loop now depends on
`ClickHouseProc.stop_server` and `ClickHouseProc.clean_logs`. A later
fix in `ClickHouseProc` (or in `FTResultsProcessor`) could leave the job
cached with stale behavior. Add both support files to the digest.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Status update:

  • Addressed both remaining review threads and pushed 8d00675:
    • 4cf0395 — a runner-level ERROR from FTResultsProcessor is no longer recomputed away by extend_sub_results before invert_bugfix_validation_status checks it (both the first-build-type extension and the per-build-type loop).
    • 8d00675 — added clickhouse_proc.py and functional_tests_results.py to the bugfix_validation_ft_pr_job cache digest.
  • Fixed the "CH Inc sync" failure: the sync PR had merge conflicts with private master (stale since the May 13 sync point). Merged master into sync-upstream/pr/97014 and resolved the three conflicts toward the current branch state (invert_bugfix_validation_status call, the Timeout-filter condition including is_flaky_check, and the pr-amd-medium runner label). The sync PR is now mergeable.

Comment thread ci/jobs/integration_test_job.py Resolved
alexey-milovidov and others added 2 commits June 12, 2026 00:37
Bugfix validation calls `find_master_builds` in every non-local run, but
the `store_data` hook populated `master_commits` only when
`info.repo_name == "ClickHouse/ClickHouse"`, so the synced private PR
workflow would reach those jobs without the key and fail with
`AssertionError: Could not find master builds in S3`. Both the commits
query and the S3 artifact namespace are hardcoded to the public upstream
repo, so storing the data unconditionally works from any repo.

Co-Authored-By: Claude Fable 5 <[email protected]>
The synthetic `OOM in dmesg` result is a harness/resource failure, but
the bugfix-validation inversion treated every `FAIL` leaf as a
reproduced bug, so a host OOM after otherwise passing tests would flip
to `OK` and hide an infrastructure failure as successful reproduction.
For bugfix validation, report it as `ERROR` and set `has_error`, the
same way the synthetic `Timeout` result is handled.

Co-Authored-By: Claude Fable 5 <[email protected]>

bugfix_validation_functional_tests:
runs-on: [self-hosted, pr-arm-medium]
runs-on: [self-hosted, pr-amd-medium]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated from ci/defs/job_configs.py: bugfix_validation_ft_pr_job switched its runs_on from FUNC_TESTER_ARM to FUNC_TESTER_AMD. The job downloads master server binaries from S3 (BUGFIX_BUILD_TYPES = ["amd_asan_ubsan", "amd_tsan", "amd_msan", "amd_debug"]) and runs them, and those x86-64 binaries cannot execute on an ARM runner — hence amd-medium.

Comment thread ci/defs/job_configs.py
bugfix_validation_ft_pr_job = Job.Config(
name=JobNames.BUGFIX_VALIDATE_FT,
runs_on=RunnerLabels.FUNC_TESTER_ARM,
runs_on=RunnerLabels.FUNC_TESTER_AMD,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job downloads and runs master server binaries from S3 to validate the fix against them. As of this PR those are AMD builds — BUGFIX_BUILD_TYPES = ["amd_asan_ubsan", "amd_tsan", "amd_msan", "amd_debug"] in ci/jobs/scripts/bugfix_validation.py. An x86-64 clickhouse binary cannot execute on an ARM runner, so the job has to run on FUNC_TESTER_AMD instead of FUNC_TESTER_ARM.

@alexey-milovidov alexey-milovidov self-assigned this Jun 13, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 13, 2026
Merged via the queue into master with commit 6a75673 Jun 13, 2026
166 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-bugfix-validation-git-ownership branch June 13, 2026 20:55
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants