mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #55694 from ClickHouse/revert-55476-ci_scripts_tuning
Revert "Integration check script fix ups"
This commit is contained in:
commit
5afabe7d59
@ -67,48 +67,6 @@ This check means that the CI system started to process the pull request. When it
|
|||||||
Performs some simple regex-based checks of code style, using the [`utils/check-style/check-style`](https://github.com/ClickHouse/ClickHouse/blob/master/utils/check-style/check-style) binary (note that it can be run locally).
|
Performs some simple regex-based checks of code style, using the [`utils/check-style/check-style`](https://github.com/ClickHouse/ClickHouse/blob/master/utils/check-style/check-style) binary (note that it can be run locally).
|
||||||
If it fails, fix the style errors following the [code style guide](style.md).
|
If it fails, fix the style errors following the [code style guide](style.md).
|
||||||
|
|
||||||
#### Running style check locally:
|
|
||||||
```sh
|
|
||||||
mkdir -p /tmp/test_output
|
|
||||||
# running all checks
|
|
||||||
docker run --rm --volume=.:/ClickHouse --volume=/tmp/test_output:/test_output -u $(id -u ${USER}):$(id -g ${USER}) --cap-add=SYS_PTRACE clickhouse/style-test
|
|
||||||
|
|
||||||
# run specified check script (e.g.: ./check-mypy)
|
|
||||||
docker run --rm --volume=.:/ClickHouse --volume=/tmp/test_output:/test_output -u $(id -u ${USER}):$(id -g ${USER}) --cap-add=SYS_PTRACE --entrypoint= -w/ClickHouse/utils/check-style clickhouse/style-test ./check-mypy
|
|
||||||
|
|
||||||
# find all style check scripts under the directory:
|
|
||||||
cd ./utils/check-style
|
|
||||||
|
|
||||||
# Check duplicate includes
|
|
||||||
./check-duplicate-includes.sh
|
|
||||||
|
|
||||||
# Check c++ formatiing
|
|
||||||
./check-style
|
|
||||||
|
|
||||||
# Check python formatting with black
|
|
||||||
./check-black
|
|
||||||
|
|
||||||
# Check python type hinting with mypy
|
|
||||||
./check-mypy
|
|
||||||
|
|
||||||
# Check code with codespell
|
|
||||||
./check-typos
|
|
||||||
|
|
||||||
# Check docs spelling
|
|
||||||
./check-doc-aspell
|
|
||||||
|
|
||||||
# Check whitespaces
|
|
||||||
./check-whitespaces
|
|
||||||
|
|
||||||
# Check github actions workflows
|
|
||||||
./check-workflows
|
|
||||||
|
|
||||||
# Check submodules
|
|
||||||
./check-submodules
|
|
||||||
|
|
||||||
# Check shell scripts with shellcheck
|
|
||||||
./shellcheck-run.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## Fast Test
|
## Fast Test
|
||||||
Normally this is the first check that is ran for a PR. It builds ClickHouse and
|
Normally this is the first check that is ran for a PR. It builds ClickHouse and
|
||||||
@ -117,15 +75,6 @@ some. If it fails, further checks are not started until it is fixed. Look at
|
|||||||
the report to see which tests fail, then reproduce the failure locally as
|
the report to see which tests fail, then reproduce the failure locally as
|
||||||
described [here](tests.md#functional-test-locally).
|
described [here](tests.md#functional-test-locally).
|
||||||
|
|
||||||
#### Running Fast Test locally:
|
|
||||||
```sh
|
|
||||||
mkdir -p /tmp/test_output
|
|
||||||
mkdir -p /tmp/fasttest-workspace
|
|
||||||
cd ClickHouse
|
|
||||||
# this docker command performs minimal ClickHouse build and run FastTests against it
|
|
||||||
docker run --rm --cap-add=SYS_PTRACE -u $(id -u ${USER}):$(id -g ${USER}) --network=host -e FASTTEST_WORKSPACE=/fasttest-workspace -e FASTTEST_OUTPUT=/test_output -e FASTTEST_SOURCE=/ClickHouse --cap-add=SYS_PTRACE -e stage=clone_submodules --volume=/tmp/fasttest-workspace:/fasttest-workspace --volume=.:/ClickHouse --volume=/tmp/test_output:/test_output clickhouse/fasttest
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### Status Page Files
|
#### Status Page Files
|
||||||
- `runlog.out.log` is the general log that includes all other logs.
|
- `runlog.out.log` is the general log that includes all other logs.
|
||||||
@ -173,13 +122,6 @@ Builds ClickHouse in various configurations for use in further steps. You have t
|
|||||||
## Special Build Check
|
## Special Build Check
|
||||||
Performs static analysis and code style checks using `clang-tidy`. The report is similar to the [build check](#build-check). Fix the errors found in the build log.
|
Performs static analysis and code style checks using `clang-tidy`. The report is similar to the [build check](#build-check). Fix the errors found in the build log.
|
||||||
|
|
||||||
#### Running clang-tidy locally:
|
|
||||||
There is a convenience `packager` script that runs the clang-tidy build in docker
|
|
||||||
```sh
|
|
||||||
mkdir build_tidy
|
|
||||||
./docker/packager/packager --output-dir=./build_tidy --package-type=binary --compiler=clang-17 --debug-build --clang-tidy
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Functional Stateless Tests
|
## Functional Stateless Tests
|
||||||
Runs [stateless functional tests](tests.md#functional-tests) for ClickHouse
|
Runs [stateless functional tests](tests.md#functional-tests) for ClickHouse
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Find CI documents and instructions on running CI checks localy [here](https://clickhouse.com/docs/en/development/continuous-integration).
|
|
@ -51,9 +51,9 @@ def get_gh_api(
|
|||||||
sleep: int = 3,
|
sleep: int = 3,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> requests.Response:
|
) -> requests.Response:
|
||||||
"""
|
"""It's a wrapper around get_with_retries that requests GH api w/o auth by
|
||||||
Request GH api w/o auth by default, and failover to the get_best_robot_token in case of receiving
|
default, and falls back to the get_best_robot_token in case of receiving
|
||||||
"403 rate limit exceeded" or "404 not found" error
|
"403 rate limit exceeded" error
|
||||||
It sets auth automatically when ROBOT_TOKEN is already set by get_best_robot_token
|
It sets auth automatically when ROBOT_TOKEN is already set by get_best_robot_token
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -71,39 +71,27 @@ def get_gh_api(
|
|||||||
if grt.ROBOT_TOKEN is not None:
|
if grt.ROBOT_TOKEN is not None:
|
||||||
set_auth_header()
|
set_auth_header()
|
||||||
|
|
||||||
token_is_set = "Authorization" in kwargs.get("headers", {})
|
need_retry = False
|
||||||
exc = Exception("A placeholder to satisfy typing and avoid nesting")
|
for _ in range(retries):
|
||||||
try_cnt = 0
|
|
||||||
while try_cnt < retries:
|
|
||||||
try_cnt += 1
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, **kwargs)
|
response = get_with_retries(url, 1, sleep, **kwargs)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response
|
return response
|
||||||
except requests.HTTPError as e:
|
except requests.HTTPError as exc:
|
||||||
exc = e
|
if (
|
||||||
ratelimit_exceeded = (
|
exc.response.status_code == 403
|
||||||
e.response.status_code == 403
|
|
||||||
and b"rate limit exceeded"
|
and b"rate limit exceeded"
|
||||||
in e.response._content # pylint:disable=protected-access
|
in exc.response._content # pylint:disable=protected-access
|
||||||
)
|
):
|
||||||
try_auth = e.response.status_code == 404
|
|
||||||
if (ratelimit_exceeded or try_auth) and not token_is_set:
|
|
||||||
logging.warning(
|
logging.warning(
|
||||||
"Received rate limit exception, setting the auth header and retry"
|
"Received rate limit exception, setting the auth header and retry"
|
||||||
)
|
)
|
||||||
set_auth_header()
|
set_auth_header()
|
||||||
token_is_set = True
|
need_retry = True
|
||||||
try_cnt = 0
|
break
|
||||||
continue
|
|
||||||
except Exception as e:
|
|
||||||
exc = e
|
|
||||||
|
|
||||||
if try_cnt < retries:
|
if need_retry:
|
||||||
logging.info("Exception '%s' while getting, retry %i", exc, try_cnt)
|
return get_with_retries(url, retries, sleep, **kwargs)
|
||||||
time.sleep(sleep)
|
|
||||||
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
|
|
||||||
def get_build_name_for_check(check_name: str) -> str:
|
def get_build_name_for_check(check_name: str) -> str:
|
||||||
|
@ -4,6 +4,8 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from typing import Dict, List, Set, Union, Literal
|
from typing import Dict, List, Set, Union, Literal
|
||||||
|
|
||||||
|
from unidiff import PatchSet # type: ignore
|
||||||
|
|
||||||
from build_download_helper import get_gh_api
|
from build_download_helper import get_gh_api
|
||||||
from env_helper import (
|
from env_helper import (
|
||||||
GITHUB_REPOSITORY,
|
GITHUB_REPOSITORY,
|
||||||
@ -169,11 +171,7 @@ class PRInfo:
|
|||||||
response_json = user_orgs_response.json()
|
response_json = user_orgs_response.json()
|
||||||
self.user_orgs = set(org["id"] for org in response_json)
|
self.user_orgs = set(org["id"] for org in response_json)
|
||||||
|
|
||||||
self.diff_urls.append(
|
self.diff_urls.append(github_event["pull_request"]["diff_url"])
|
||||||
f"https://api.github.com/repos/{GITHUB_REPOSITORY}/"
|
|
||||||
f"compare/master...{self.head_ref}"
|
|
||||||
)
|
|
||||||
|
|
||||||
elif "commits" in github_event:
|
elif "commits" in github_event:
|
||||||
# `head_commit` always comes with `commits`
|
# `head_commit` always comes with `commits`
|
||||||
commit_message = github_event["head_commit"]["message"] # type: str
|
commit_message = github_event["head_commit"]["message"] # type: str
|
||||||
@ -217,12 +215,12 @@ class PRInfo:
|
|||||||
# files changed in upstream AND master...{self.head_ref}
|
# files changed in upstream AND master...{self.head_ref}
|
||||||
# to get files, changed in current HEAD
|
# to get files, changed in current HEAD
|
||||||
self.diff_urls.append(
|
self.diff_urls.append(
|
||||||
f"https://api.github.com/repos/{GITHUB_REPOSITORY}/"
|
f"https://github.com/{GITHUB_REPOSITORY}/"
|
||||||
f"compare/master...{self.head_ref}"
|
f"compare/master...{self.head_ref}.diff"
|
||||||
)
|
)
|
||||||
self.diff_urls.append(
|
self.diff_urls.append(
|
||||||
f"https://api.github.com/repos/{GITHUB_REPOSITORY}/"
|
f"https://github.com/{GITHUB_REPOSITORY}/"
|
||||||
f"compare/{self.head_ref}...master"
|
f"compare/{self.head_ref}...master.diff"
|
||||||
)
|
)
|
||||||
# Get release PR number.
|
# Get release PR number.
|
||||||
self.release_pr = get_pr_for_commit(self.base_ref, self.base_ref)[
|
self.release_pr = get_pr_for_commit(self.base_ref, self.base_ref)[
|
||||||
@ -234,8 +232,8 @@ class PRInfo:
|
|||||||
# For release PRs we must get not only files changed in the PR
|
# For release PRs we must get not only files changed in the PR
|
||||||
# itself, but as well files changed since we branched out
|
# itself, but as well files changed since we branched out
|
||||||
self.diff_urls.append(
|
self.diff_urls.append(
|
||||||
f"https://api.github.com/repos/{GITHUB_REPOSITORY}/"
|
f"https://github.com/{GITHUB_REPOSITORY}/"
|
||||||
f"compare/{self.head_ref}...master"
|
f"compare/{self.head_ref}...master.diff"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print("event.json does not match pull_request or push:")
|
print("event.json does not match pull_request or push:")
|
||||||
@ -263,11 +261,19 @@ class PRInfo:
|
|||||||
raise TypeError("The event does not have diff URLs")
|
raise TypeError("The event does not have diff URLs")
|
||||||
|
|
||||||
for diff_url in self.diff_urls:
|
for diff_url in self.diff_urls:
|
||||||
response = get_gh_api(diff_url, sleep=RETRY_SLEEP)
|
response = get_gh_api(
|
||||||
|
diff_url,
|
||||||
|
sleep=RETRY_SLEEP,
|
||||||
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
diff = response.json()
|
if "commits" in self.event and self.number == 0:
|
||||||
if "files" in diff:
|
diff = response.json()
|
||||||
self.changed_files = {f["filename"] for f in diff["files"]}
|
|
||||||
|
if "files" in diff:
|
||||||
|
self.changed_files = {f["filename"] for f in diff["files"]}
|
||||||
|
else:
|
||||||
|
diff_object = PatchSet(response.text)
|
||||||
|
self.changed_files.update({f.path for f in diff_object})
|
||||||
print(f"Fetched info about {len(self.changed_files)} changed files")
|
print(f"Fetched info about {len(self.changed_files)} changed files")
|
||||||
|
|
||||||
def get_dict(self):
|
def get_dict(self):
|
||||||
|
@ -90,7 +90,6 @@ systemctl restart docker
|
|||||||
sudo -u ubuntu docker buildx version
|
sudo -u ubuntu docker buildx version
|
||||||
sudo -u ubuntu docker buildx create --use --name default-builder
|
sudo -u ubuntu docker buildx create --use --name default-builder
|
||||||
|
|
||||||
# FIXME: remove unidiff as soon as no old PRs could use it, here and in Dockerfile
|
|
||||||
pip install boto3 pygithub requests urllib3 unidiff dohq-artifactory
|
pip install boto3 pygithub requests urllib3 unidiff dohq-artifactory
|
||||||
|
|
||||||
mkdir -p $RUNNER_HOME && cd $RUNNER_HOME
|
mkdir -p $RUNNER_HOME && cd $RUNNER_HOME
|
||||||
|
Loading…
Reference in New Issue
Block a user