From b85a962b00131de5b63c51f9e95ccfd31a3de801 Mon Sep 17 00:00:00 2001 From: kimpaller Date: Tue, 23 Apr 2024 13:13:41 +0800 Subject: [PATCH] add result status to all Built projects regardless if HW available or not Signed-off-by: kimpaller --- telemetry/cli.py | 46 ++++++++++++++++++++++-------------- telemetry/report/markdown.py | 9 ++++++- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/telemetry/cli.py b/telemetry/cli.py index 295fc63..a322514 100644 --- a/telemetry/cli.py +++ b/telemetry/cli.py @@ -217,25 +217,35 @@ def create_results_gist(server, job_name, build_number, board_name, github_gist_ job_no = build_number, artifact_info_type = "info_txt", ) - for bn, info in boot_test.items(): - artifacts = tel.artifacts(board_name, job_name, build_number) - artifact_types = ["enumerated_devs", "missing_devs", "dmesg_err", "pytest_failure"] - for artifactory_type in artifact_types: - info[0].update({artifactory_type: []}) - for artifact in artifacts: - if artifact["artifact_info_type"] == artifactory_type: - info[0][artifactory_type].append(artifact["payload"]) - - if artifacts_info_txt: - info[0]["info_txt"] = dict() - info[0]["info_txt"].update({"Built projects": list()}) - for artifact in artifacts_info_txt: - if artifact["payload"] == "Built projects": - info[0]["info_txt"]["Built projects"].append(artifact["payload_param"]) - continue - info[0]["info_txt"].update({artifact["payload"]:artifact["payload_param"]}) + built_projects = list() + for artifact in artifacts_info_txt: + if artifact["payload"] == "Built projects": + built_projects.append(artifact["payload_param"]) + + for board in built_projects: + if not board in boot_test.keys(): + data[board] = "NA" + else: + bn = board + info = boot_test[board] + artifacts = tel.artifacts(board, job_name, build_number) + artifact_types = ["enumerated_devs", "missing_devs", "dmesg_err", "pytest_failure"] + for artifactory_type in artifact_types: + info[0].update({artifactory_type: []}) + for artifact in artifacts: + if artifact["artifact_info_type"] == artifactory_type: + info[0][artifactory_type].append(artifact["payload"]) + + if artifacts_info_txt: + info[0]["info_txt"] = dict() + info[0]["info_txt"].update({"Built projects": list()}) + for artifact in artifacts_info_txt: + if artifact["payload"] == "Built projects": + info[0]["info_txt"]["Built projects"].append(artifact["payload_param"]) + continue + info[0]["info_txt"].update({artifact["payload"]:artifact["payload_param"]}) - data[bn] = info[0] + data[bn] = info[0] m = telemetry.markdown.ResultsMarkdown(data) m.generate_gist(github_gist_url, github_gist_token) diff --git a/telemetry/report/markdown.py b/telemetry/report/markdown.py index 48b4ff0..76e5164 100644 --- a/telemetry/report/markdown.py +++ b/telemetry/report/markdown.py @@ -37,6 +37,9 @@ def __init__(self, data): def generate_param(self,data): param_dict = {} for bn, info in data.items(): + if info == "NA": + param_dict[bn] = None + continue test_build_status = None if str(info["last_failing_stage"]) in self.CRITICAL: test_build_status = "FAILURE" @@ -106,10 +109,14 @@ def generate_param(self,data): return param_dict def generate_gist(self, url, token): + print(f"========== Publish Results ==========") for bn,param in self.param_dict.items(): + if not param: + print(f'Result: {bn} | ---- | HW not available') + continue outfile = self.generate(param, bn+".md") gist = telemetry.gist.Gist(url, token) gist_link = gist.create_gist(outfile, f'''Boardname: {param["board_name"]}\n Branch: {param["branch"]}\nPR ID: {param["pr_id"]}\n timestamp: {param["timestamp"]}''') - print(f'Gist created: {gist.gh_url}/{gist_link} - {param["test_status"]}') + print(f'Result: {bn} | {gist.gh_url}/{gist_link} | {param["test_status"]}')