Skip to content

Fix sending email #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions daily_tests/daily_nightly_tests_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ def prepare(self) -> bool:
return True

def send_file_to_pastebin(self, log_path, log_name: str):
if not os.path.exists(log_name):
if not os.path.exists(log_path):
return
send_paste_bin = os.getenv("HOME") + "/ci-scripts/send_to_paste_bin.sh"
cmd = f'{send_paste_bin} "{log_path}" "{log_name}"'
print(f"sending logs to pastebin: {cmd}")
try:
run_command(cmd)
except subprocess.CalledProcessError:
Expand Down Expand Up @@ -244,14 +245,14 @@ def collect_data(self):
for sclorg in ["S2I", "NOS2I"]:
name = f"{test_case}-{sclorg}"
self.send_file_to_pastebin(
log_path=Path(SCLORG_DIR) / f"{test_case}-{sclorg}" / "log.txt",
log_name=f"{RESULTS_DIR}/{name}.txt",
log_path=Path(SCLORG_DIR) / f"{name}" / "log.txt",
log_name=f"{path_dir}/{name}.log.txt",
)
self.data_dict["tmt"]["logs"].append(
(
name,
Path(SCLORG_DIR) / f"{test_case}-{sclorg}" / "log.txt",
Path(RESULTS_DIR) / f"{name}.txt",
Path(SCLORG_DIR) / f"{name}" / "log.txt",
Path(path_dir) / f"{name}.log.txt",
)
)
failed_tests = True
Expand All @@ -267,14 +268,14 @@ def collect_data(self):
for sclorg in ["S2I", "NOS2I"]:
name = f"{test_case}-{sclorg}"
self.send_file_to_pastebin(
log_path=Path(SCLORG_DIR) / f"{test_case}-{sclorg}" / "log.txt",
log_name=f"{RESULTS_DIR}/{name}.txt",
log_path=Path(SCLORG_DIR) / f"{name}" / "log.txt",
log_name=f"{path_dir}/{name}.log.txt",
)
self.data_dict["tmt"]["logs"].append(
(
name,
Path(SCLORG_DIR) / f"{test_case}-{sclorg}" / "log.txt",
Path(RESULTS_DIR) / f"{name}.txt",
Path(SCLORG_DIR) / f"{name}" / "log.txt",
Path(path_dir) / f"{name}.log.txt",
)
)
failed_tests = True
Expand All @@ -288,20 +289,22 @@ def collect_data(self):
for sclorg in ["S2I", "NOS2I"]:
name = f"{test_case}-{sclorg}"
self.send_file_to_pastebin(
log_path=Path(SCLORG_DIR) / f"{test_case}-{sclorg}" / "log.txt",
log_name=f"{RESULTS_DIR}/{name}.txt",
log_path=Path(SCLORG_DIR) / f"{name}" / "log.txt",
log_name=f"{path_dir}/{name}.log.txt",
)
self.data_dict["tmt"]["logs"].append(
(
name,
Path(SCLORG_DIR) / f"{test_case}-{sclorg}" / "log.txt",
Path(RESULTS_DIR) / f"{name}.txt",
Path(SCLORG_DIR) / f"{name}" / "log.txt",
Path(path_dir) / f"{name}.log.txt",
)
)
failed_tests = True
continue
results_dir = data_dir / "results"
print("Results dir is for failed_container: ", results_dir)
failed_containers = list(results_dir.rglob("*.log"))
print("Failed containers are: ", failed_containers)
if not failed_containers:
self.data_dict["SUCCESS"].append(test_case)
if self.args.upstream_tests:
Expand Down Expand Up @@ -357,6 +360,9 @@ def generate_email_body(self):

def generate_failed_containers(self):
for test_case, plan, msg in self.available_test_case:
print(
f"generate_email_body_for_failed_containers: {test_case}, {plan}, {msg}"
)
if test_case not in self.data_dict:
continue
print(
Expand Down
2 changes: 1 addition & 1 deletion daily_tests/daily_scl_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function iterate_over_all_containers() {
make "${TESTS}" TARGET="${TARGET}" > "${log_name}" 2>&1
if [[ $? -ne 0 ]]; then
echo "Tests for container $repo has failed."
$PBINCLI send $PBINCLI_OPTS < "${log_name}" > "${RESULT_DIR}/${repo}.txt" 2>&1
cp "${log_name}" "${RESULT_DIR}/"
echo "Show the last 100 lines from file: ${RESULT_DIR}/${repo}.log"
tail -100 "${RESULT_DIR}/${repo}.log"
fi
Expand Down