|
5 | 5 | import click |
6 | 6 | from tabulate import tabulate |
7 | 7 |
|
8 | | -from kcidev.libs.common import kci_msg, kci_msg_json, kci_msg_red |
| 8 | +from kcidev.libs.common import kci_msg, kci_msg_bold_nonl, kci_msg_json, kci_msg_red |
9 | 9 | from kcidev.subcommands.maestro.results import results |
10 | 10 | from kcidev.subcommands.results import boots, builds |
11 | 11 |
|
@@ -124,14 +124,72 @@ def get_build_stats(ctx, giturl, branch, commit, tree_name, verbose, arch): |
124 | 124 | return stats |
125 | 125 |
|
126 | 126 |
|
127 | | -def print_stats(data, headers, max_col_width, table_fmt): |
| 127 | +def print_table_stats(data, headers, max_col_width, table_fmt): |
128 | 128 | """Print build statistics in tabular format""" |
129 | 129 | print("Creating a stats report...") |
130 | 130 | print( |
131 | 131 | tabulate(data, headers=headers, maxcolwidths=max_col_width, tablefmt=table_fmt) |
132 | 132 | ) |
133 | 133 |
|
134 | 134 |
|
| 135 | +def print_simple_list(data, history=False): |
| 136 | + """Print a simple list format showing tree/branch with status and missing IDs""" |
| 137 | + |
| 138 | + if history: |
| 139 | + # For history mode, group by tree/branch and show overall status |
| 140 | + from collections import defaultdict |
| 141 | + |
| 142 | + tree_groups = defaultdict(list) |
| 143 | + |
| 144 | + for row in data: |
| 145 | + tree_branch = row[0] # tree/branch |
| 146 | + comparison = row[4] # Build count comparison (✅ or ❌) |
| 147 | + missing_ids = row[5] # Missing build IDs |
| 148 | + commit = row[1] # Commit hash |
| 149 | + |
| 150 | + tree_groups[tree_branch].append( |
| 151 | + {"commit": commit, "status": comparison, "missing_ids": missing_ids} |
| 152 | + ) |
| 153 | + |
| 154 | + for tree_branch, commits in tree_groups.items(): |
| 155 | + # Check if any commit has issues |
| 156 | + has_issues = any(commit["status"] == "❌" for commit in commits) |
| 157 | + status_icon = "❌" if has_issues else "✅" |
| 158 | + |
| 159 | + kci_msg_bold_nonl(f"{tree_branch}: ") |
| 160 | + kci_msg(f"{status_icon}") |
| 161 | + |
| 162 | + if has_issues: |
| 163 | + for commit in commits: |
| 164 | + if commit["status"] == "❌" and commit["missing_ids"]: |
| 165 | + kci_msg(f" Commit {commit['commit'][:12]}:") |
| 166 | + for id in commit["missing_ids"]: |
| 167 | + kci_msg(f" - https://api.kernelci.org/viewer?node_id={id}") |
| 168 | + elif commit["status"] == "❌": |
| 169 | + kci_msg( |
| 170 | + f" Commit {commit['commit'][:12]}: Has mismatch but no missing IDs listed" |
| 171 | + ) |
| 172 | + else: |
| 173 | + # For non-history mode, show each individual result |
| 174 | + for row in data: |
| 175 | + tree_branch = row[0] # tree/branch |
| 176 | + commit = row[1] # commit |
| 177 | + comparison = row[4] # Build count comparison (✅ or ❌) |
| 178 | + missing_ids = row[5] # Missing build IDs |
| 179 | + |
| 180 | + kci_msg_bold_nonl(f"• {tree_branch}: ") |
| 181 | + kci_msg(f"{comparison}") |
| 182 | + kci_msg(f" Commit: {commit}") |
| 183 | + |
| 184 | + if comparison == "❌" and missing_ids: |
| 185 | + kci_msg(" Missing builds:") |
| 186 | + for id in missing_ids: |
| 187 | + kci_msg(f" - https://api.kernelci.org/viewer?node_id={id}") |
| 188 | + elif comparison == "❌": |
| 189 | + kci_msg(f" Has mismatch but no missing IDs listed") |
| 190 | + kci_msg("") |
| 191 | + |
| 192 | + |
135 | 193 | def validate_boot_status(maestro_boots, dashboard_boots): |
136 | 194 | """ |
137 | 195 | Validate if the boot status of dashboard pulled boot |
|
0 commit comments