mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 11:32:03 +00:00
Backport #66523 to 24.6: Add additional log masking in CI
This commit is contained in:
parent
c4a8a058a9
commit
8f2aea832f
@ -24,6 +24,18 @@ from tee_popen import TeePopen
|
|||||||
NO_CHANGES_MSG = "Nothing to run"
|
NO_CHANGES_MSG = "Nothing to run"
|
||||||
|
|
||||||
|
|
||||||
|
class SensitiveFormatter(logging.Formatter):
|
||||||
|
@staticmethod
|
||||||
|
def _filter(s):
|
||||||
|
return re.sub(
|
||||||
|
r"(.*)(AZURE_CONNECTION_STRING.*\')(.*)", r"\1AZURE_CONNECTION_STRING\3", s
|
||||||
|
)
|
||||||
|
|
||||||
|
def format(self, record):
|
||||||
|
original = logging.Formatter.format(self, record)
|
||||||
|
return self._filter(original)
|
||||||
|
|
||||||
|
|
||||||
def get_additional_envs(
|
def get_additional_envs(
|
||||||
check_name: str, run_by_hash_num: int, run_by_hash_total: int
|
check_name: str, run_by_hash_num: int, run_by_hash_total: int
|
||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
@ -206,6 +218,9 @@ def parse_args():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
for handler in logging.root.handlers:
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
handler.setFormatter(SensitiveFormatter(handler.formatter._fmt)) # type: ignore
|
||||||
|
|
||||||
stopwatch = Stopwatch()
|
stopwatch = Stopwatch()
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import csv
|
import csv
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -19,6 +20,18 @@ from stopwatch import Stopwatch
|
|||||||
from tee_popen import TeePopen
|
from tee_popen import TeePopen
|
||||||
|
|
||||||
|
|
||||||
|
class SensitiveFormatter(logging.Formatter):
|
||||||
|
@staticmethod
|
||||||
|
def _filter(s):
|
||||||
|
return re.sub(
|
||||||
|
r"(.*)(AZURE_CONNECTION_STRING.*\')(.*)", r"\1AZURE_CONNECTION_STRING\3", s
|
||||||
|
)
|
||||||
|
|
||||||
|
def format(self, record):
|
||||||
|
original = logging.Formatter.format(self, record)
|
||||||
|
return self._filter(original)
|
||||||
|
|
||||||
|
|
||||||
def get_additional_envs(check_name: str) -> List[str]:
|
def get_additional_envs(check_name: str) -> List[str]:
|
||||||
result = []
|
result = []
|
||||||
azure_connection_string = get_parameter_from_ssm("azure_connection_string")
|
azure_connection_string = get_parameter_from_ssm("azure_connection_string")
|
||||||
@ -114,6 +127,9 @@ def process_results(
|
|||||||
|
|
||||||
def run_stress_test(docker_image_name: str) -> None:
|
def run_stress_test(docker_image_name: str) -> None:
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
for handler in logging.root.handlers:
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
handler.setFormatter(SensitiveFormatter(handler.formatter._fmt)) # type: ignore
|
||||||
|
|
||||||
stopwatch = Stopwatch()
|
stopwatch = Stopwatch()
|
||||||
temp_path = Path(TEMP_PATH)
|
temp_path = Path(TEMP_PATH)
|
||||||
|
Loading…
Reference in New Issue
Block a user