5
5
import click
6
6
from tabulate import tabulate
7
7
8
- from kcidev .libs .common import kci_msg , kci_msg_bold_nonl , kci_msg_json , kci_msg_red
8
+ from kcidev .libs .common import kci_msg , kci_msg_bold , 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
@@ -46,6 +46,8 @@ def get_builds(ctx, giturl, branch, commit, arch):
46
46
return maestro_builds , None
47
47
except click .ClickException as e :
48
48
kci_msg_red (f"{ branch } /{ commit } : { e .message } " )
49
+ if "No builds available" in e .message :
50
+ return maestro_builds , []
49
51
return maestro_builds , None
50
52
return maestro_builds , dashboard_builds
51
53
@@ -132,7 +134,20 @@ def print_table_stats(data, headers, max_col_width, table_fmt):
132
134
)
133
135
134
136
135
- def print_simple_list (data , history = False ):
137
+ def extract_validation_data (row : list ):
138
+ """Extract information from validation stats"""
139
+ try :
140
+ tree_branch = row [0 ]
141
+ commit = row [1 ] # Commit hash
142
+ comparison = row [4 ] # Build/boot count comparison (✅ or ❌)
143
+ missing_ids = row [5 ] # Missing build/boot IDs
144
+ return tree_branch , commit , comparison , missing_ids
145
+ except IndexError :
146
+ kci_msg_red ("Failed to extract data for list view report" )
147
+ raise ValueError ()
148
+
149
+
150
+ def print_simple_list (data , item_type , history = False ):
136
151
"""Print a simple list format showing tree/branch with status and missing IDs"""
137
152
138
153
if history :
@@ -142,47 +157,42 @@ def print_simple_list(data, history=False):
142
157
tree_groups = defaultdict (list )
143
158
144
159
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
-
160
+ try :
161
+ tree_branch , commit , comparison , missing_ids = extract_validation_data (
162
+ row
163
+ )
164
+ except ValueError :
165
+ continue
150
166
tree_groups [tree_branch ].append (
151
167
{"commit" : commit , "status" : comparison , "missing_ids" : missing_ids }
152
168
)
153
169
154
170
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
- )
171
+ kci_msg_bold (f"{ tree_branch } : " )
172
+ for commit in commits :
173
+ if commit ["status" ] == "❌" and commit ["missing_ids" ]:
174
+ kci_msg (f" Commit { commit ['commit' ][:12 ]} : ❌" )
175
+ kci_msg (f" Missing { item_type } : { len (commit ['missing_ids' ])} " )
176
+ for id in commit ["missing_ids" ]:
177
+ kci_msg (f" - https://api.kernelci.org/viewer?node_id={ id } " )
178
+ elif commit ["status" ] == "✅" :
179
+ kci_msg (f" Commit { commit ['commit' ][:12 ]} : ✅" )
180
+
172
181
else :
173
182
# For non-history mode, show each individual result
174
183
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 } : " )
184
+ try :
185
+ tree_branch , commit , comparison , missing_ids = extract_validation_data (
186
+ row
187
+ )
188
+ except ValueError :
189
+ continue
190
+ kci_msg_bold (f"• { tree_branch } : " , nl = False )
181
191
kci_msg (f"{ comparison } " )
182
192
kci_msg (f" Commit: { commit } " )
183
193
184
194
if comparison == "❌" and missing_ids :
185
- kci_msg (" Missing builds: " )
195
+ kci_msg (f " Missing { item_type } : { len ( missing_ids ) } " )
186
196
for id in missing_ids :
187
197
kci_msg (f" - https://api.kernelci.org/viewer?node_id={ id } " )
188
198
elif comparison == "❌" :
@@ -382,4 +392,6 @@ def get_builds_history(ctx, checkouts, arch):
382
392
kci_msg_red (f"{ branch } /{ commit } : Aborted while fetching dashboard builds" )
383
393
except click .ClickException as e :
384
394
kci_msg_red (f"{ branch } /{ commit } : { e .message } " )
395
+ if "No builds available" in e .message :
396
+ builds_history .append ([commit , maestro_builds , []])
385
397
return builds_history
0 commit comments