@@ -530,7 +530,7 @@ def get_lease(build_log_response,job_platform):
530530 '''
531531
532532 lease = ""
533- zone_log_re = re .compile ('(Acquired 1 lease\(s\) for {}-quota-slice: \[)([^]]+)(\])' .format (job_platform ), re .MULTILINE | re .DOTALL )
533+ zone_log_re = re .compile (r '(Acquired 1 lease\(s\) for {}-quota-slice: \[)([^]]+)(\])' .format (job_platform ), re .MULTILINE | re .DOTALL )
534534 zone_log_match = zone_log_re .search (build_log_response .text )
535535 if zone_log_match is None :
536536 lease = "Failed to fetch lease information"
@@ -698,7 +698,7 @@ def get_failed_monitor_testcases(spy_link,job_type):
698698 response = requests .get (test_log_junit_dir_url , verify = False , timeout = 15 )
699699
700700 if response .status_code == 200 :
701- monitor_test_failure_summary_filename_re = re .compile ('(test-failures-summary_monitor_2[^.]*\.json)' )
701+ monitor_test_failure_summary_filename_re = re .compile (r '(test-failures-summary_monitor_2[^.]*\.json)' )
702702 monitor_test_failure_summary_filename_match = monitor_test_failure_summary_filename_re .search (response .text , re .MULTILINE | re .DOTALL )
703703
704704 if monitor_test_failure_summary_filename_match is not None :
@@ -748,7 +748,7 @@ def get_failed_monitor_testcases_from_xml(spy_link,job_type):
748748 response = requests .get (test_log_junit_dir_url , verify = False , timeout = 15 )
749749
750750 if response .status_code == 200 :
751- test_failure_summary_filename_re = re .compile ('(e2e-monitor-tests__2[^.]*\.xml)' )
751+ test_failure_summary_filename_re = re .compile (r '(e2e-monitor-tests__2[^.]*\.xml)' )
752752 test_failure_summary_filename_match = test_failure_summary_filename_re .search (response .text , re .MULTILINE | re .DOTALL )
753753
754754 if test_failure_summary_filename_match is not None :
@@ -841,7 +841,7 @@ def get_failed_e2e_testcases(spy_link,job_type):
841841 response = requests .get (test_log_junit_dir_url , verify = False , timeout = 15 )
842842
843843 if response .status_code == 200 :
844- test_failure_summary_filename_re = re .compile ('(test-failures-summary_2[^.]*\.json)' )
844+ test_failure_summary_filename_re = re .compile (r '(test-failures-summary_2[^.]*\.json)' )
845845 test_failure_summary_filename_match = test_failure_summary_filename_re .search (response .text , re .MULTILINE | re .DOTALL )
846846
847847 if test_failure_summary_filename_match is not None :
@@ -1222,7 +1222,7 @@ def get_next_page_first_build_date(ci_next_page_spylink,end_date):
12221222 print ("Failed to extract the spy-links from spylink please check the UI!" )
12231223 return "ERROR"
12241224
1225- def get_brief_job_info (build_list ,prow_ci_name ,zone = None ):
1225+ def get_brief_job_info (build_list ,prow_ci_name ,zone = None , job_filter = 'All' ):
12261226
12271227 """
12281228 Gets brief information of all the jobs
@@ -1247,6 +1247,11 @@ def get_brief_job_info(build_list,prow_ci_name,zone=None):
12471247 for build in build_list :
12481248 match = re .search (pattern_build_id , build )
12491249 build_id = match .group (1 )
1250+ cluster_status = cluster_deploy_status (build )
1251+ if job_filter == "success" and (cluster_status == "FAILURE" or cluster_status == "ERROR" ):
1252+ continue
1253+ elif job_filter == "failure" and cluster_status == 'SUCCESS' :
1254+ continue
12501255 try :
12511256 url = constants .PROW_VIEW_URL + build [8 :] + '/prowjob.json'
12521257 time = fetch_build_time (url )
@@ -1291,93 +1296,100 @@ def get_brief_job_info(build_list,prow_ci_name,zone=None):
12911296 summary_list .append (job_dict )
12921297 return summary_list
12931298
1294- def get_detailed_job_info (build_list ,prow_ci_name ,zone = None ):
1295-
1299+ def get_detailed_job_info (build_list , prow_ci_name , zone = None , job_filter = "all" ):
12961300 """
12971301 Prints detailed information of all the jobs.
12981302
12991303 Args:
13001304 build_list: list of builds
13011305 prow_ci_name: CI name
1302- zone(string, optional): Cluster deployment zone
1306+ zone (string, optional): Cluster deployment zone
1307+ install_status_filter (string, optional): 'all' (default), 'success', or 'failure'
1308+ - 'failure' → show only cluster installs that failed or error
1309+ - 'success' → show only cluster installs that
1310+ - 'all' → show all builds
1311+
13031312 """
13041313
1305- if isinstance (build_list ,str ):
1314+ if isinstance (build_list , str ):
13061315 print (build_list )
13071316 return 1
1308-
1309- if len (build_list ) > 0 :
1310- print ("--------------------------------------------------------------------------------------------------" )
1311- print (prow_ci_name )
13121317
13131318 deploy_count = 0
13141319 e2e_count = 0
1315- i = 0
1320+ i = 0
13161321
13171322 builds_to_deleted = []
13181323 for build in build_list :
13191324 lease , nightly = get_quota_and_nightly (build )
1325+ cluster_status = cluster_deploy_status (build )
1326+ if job_filter == "success" and (cluster_status == "FAILURE" or cluster_status == "ERROR" ):
1327+ continue
1328+ elif job_filter == "failure" and cluster_status == 'SUCCESS' :
1329+ continue
1330+ print ("--------------------------------------------------------------------------------------------------" )
1331+ print (prow_ci_name )
13201332 if zone is not None and lease not in zone :
13211333 builds_to_deleted .append (build )
13221334 continue
1323- i = i + 1
1324- print (i ,"Job link:" + constants .JOB_LINK_URL + build )
1335+ i += 1
1336+ print (i , "Job link:" + constants .JOB_LINK_URL + build )
13251337 try :
13261338 url = constants .PROW_VIEW_URL + build [8 :] + '/prowjob.json'
1327- time = fetch_build_time (url )
1339+ time = fetch_build_time (url )
13281340 print ("Build start time:" , time )
13291341 except (requests .exceptions .RequestException , KeyError , ValueError ) as e :
13301342 print ("Error fetching build time:" , e )
1343+
13311344 build_status = check_job_status (build )
1332- sensitive_info_expose_status = check_if_sensitive_info_exposed (build )
1345+ sensitive_info_expose_status = check_if_sensitive_info_exposed (build )
13331346
1334- if sensitive_info_expose_status == True :
1347+ if sensitive_info_expose_status :
13351348 print ("*********************************" )
13361349 print ("Build log removed" )
13371350 print ("*********************************" )
13381351
13391352 print ("Nightly info-" , nightly )
1340-
13411353 if build_status == 'SUCCESS' :
1354+
13421355 deploy_count += 1
1343- e2e_count = e2e_count + 1
1356+ e2e_count += 1
13441357 if "sno" not in build :
13451358 print ("Lease Quota-" , lease )
13461359 check_node_crash (build )
13471360 print ("Build Passed" )
1361+
13481362 elif build_status == 'FAILURE' :
1349- cluster_status = cluster_deploy_status (build )
13501363 if "sno" not in build :
13511364 print ("Lease Quota-" , lease )
13521365 node_status = get_node_status (build )
13531366 print (node_status )
13541367 hypervisor_error_status = check_hypervisor_error (build )
13551368 if hypervisor_error_status :
1356- print ("Cluster Creation Failed." + constants .HYPERVISOR_CONNECTION_ERROR )
1357- else :
1369+ print ("Cluster Creation Failed." + constants .HYPERVISOR_CONNECTION_ERROR )
1370+ else :
13581371 check_node_crash (build )
13591372
13601373 if cluster_status == 'SUCCESS' :
13611374 deploy_count += 1
13621375 if "sno" not in prow_ci_name :
1363- job_type ,_ = job_classifier (build )
1364- tc_exe_status = print_all_failed_tc (build ,job_type )
1365- if tc_exe_status == "SUCCESS" :
1366- e2e_count = e2e_count + 1
1376+ job_type , _ = job_classifier (build )
1377+ tc_exe_status = print_all_failed_tc (build , job_type )
1378+ if tc_exe_status == "SUCCESS" :
1379+ e2e_count += 1
13671380
13681381 elif cluster_status == 'FAILURE' :
13691382 print ("Cluster Creation Failed" )
1370-
13711383
1372- elif cluster_status == 'ERROR' and not hypervisor_error_status :
1384+ elif cluster_status == 'ERROR' and not hypervisor_error_status :
13731385 print ('Unable to get cluster status please check prowCI UI ' )
13741386 else :
13751387 print (build_status )
13761388
13771389 print ("\n " )
1378-
1390+
13791391 build_list = list (set (build_list ) - set (builds_to_deleted ))
1380- if len (build_list ) != 0 :
1392+ if len (build_list ) != 0 and i != 0 :
13811393 print ("\n {}/{} deploys succeeded" .format (deploy_count , len (build_list )))
13821394 print ("{}/{} e2e tests succeeded" .format (e2e_count , len (build_list )))
1383- print ("--------------------------------------------------------------------------------------------------" )
1395+ print ("--------------------------------------------------------------------------------------------------" )
0 commit comments