Skip to content

Commit 2a21cb4

Browse files
author
Power Cloud Robot
authored
Merge pull request #51 from SurajGudaji/tmp-fix
Added changes to get node status for older ci jobs
2 parents 2c13e56 + ab475ac commit 2a21cb4

File tree

2 files changed

+62
-22
lines changed

2 files changed

+62
-22
lines changed

CI_JobHistory.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ def check_for_node_crashes(job_list, zone):
6161
lease,_ = monitor.get_quota_and_nightly(url)
6262
if zone is not None and lease not in zone :
6363
continue
64+
job_status = monitor.check_job_status(url)
6465
cluster_deploy_status = monitor.cluster_deploy_status(url)
65-
if cluster_deploy_status == 'SUCCESS':
66+
print(job_id)
67+
if cluster_deploy_status == 'SUCCESS' and job_status == 'FAILURE':
6668
node_status = monitor.get_node_status(url)
67-
print(job_id,node_status)
69+
print(node_status)
6870
monitor.check_node_crash(url)
6971
print("--------------------------------------------------------------------------------------------------")
7072

@@ -86,12 +88,14 @@ def get_failed_testcases(spylinks, zone):
8688
lease,_ = monitor.get_quota_and_nightly(spylink)
8789
if zone is not None and lease not in zone :
8890
continue
89-
cluster_status=monitor.cluster_deploy_status(spylink)
90-
if cluster_status == 'SUCCESS':
91-
j=j+1
92-
print(str(j)+".",job_id)
93-
monitor.print_all_failed_tc(spylink,job_type)
94-
print("\n")
91+
job_status=monitor.check_job_status(spylink)
92+
if job_status == 'FAILURE':
93+
cluster_status=monitor.cluster_deploy_status(spylink)
94+
if cluster_status == 'SUCCESS':
95+
j=j+1
96+
print(str(j)+".",job_id)
97+
monitor.print_all_failed_tc(spylink,job_type)
98+
print("\n")
9599
print("--------------------------------------------------------------------------------------------------")
96100
print("\n")
97101

@@ -129,8 +133,10 @@ def get_testcase_failure(spylinks, zone, tc_name):
129133
lease,_ = monitor.get_quota_and_nightly(spylink)
130134
if zone is not None and lease not in zone :
131135
continue
132-
cluster_status=monitor.cluster_deploy_status(spylink)
133-
if cluster_status == 'SUCCESS':
136+
job_status=monitor.check_job_status(spylink)
137+
if job_status == 'FAILURE':
138+
cluster_status=monitor.cluster_deploy_status(spylink)
139+
if cluster_status == 'SUCCESS':
134140
if monitor.check_testcase_failure(spylink,job_type,tc_name):
135141
j=j+1
136142
print(str(j)+"."+"Job_id: "+job_id)

monitor.py

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,25 @@ def cluster_creation_error_analysis(spylink):
312312
except requests.RequestException:
313313
return "Error while sending request to url"
314314

315+
#This is a temporary fix to check node details for older jobs.
316+
def check_if_gather_libvirt_dir_exists(spy_link,job_type):
317+
318+
base_artifacts_dir_url = PROW_VIEW_URL + spy_link[8:] + "/artifacts/" + job_type
319+
320+
try:
321+
response = requests.get(base_artifacts_dir_url, verify=False, timeout=15)
322+
gather_libvirt_dir_re = re.compile('gather-libvirt')
323+
gather_libvirt_dir_re_match = gather_libvirt_dir_re.search(response.text, re.MULTILINE|re.DOTALL)
324+
325+
if gather_libvirt_dir_re_match is not None:
326+
return True
327+
else:
328+
return False
329+
except requests.Timeout:
330+
return "Request timed out"
331+
except requests.RequestException:
332+
return "Error while sending request to url"
333+
315334
def get_node_status(spy_link):
316335

317336
'''
@@ -325,7 +344,13 @@ def get_node_status(spy_link):
325344
'''
326345

327346
job_type,job_platform = job_classifier(spy_link)
328-
job_type += "/gather-extra"
347+
348+
check_for_gather_libvirt_dir = check_if_gather_libvirt_dir_exists(spy_link,job_type)
349+
350+
if check_for_gather_libvirt_dir == True:
351+
job_type += "/gather-libvirt"
352+
else:
353+
job_type += "/gather-extra"
329354

330355
node_log_url = PROW_VIEW_URL + spy_link[8:] + \
331356
"/artifacts/" + job_type +"/artifacts/oc_cmds/nodes"
@@ -717,7 +742,12 @@ def get_junit_symptom_detection_testcase_failures(spy_link,job_type):
717742

718743
symptom_detection_failed_testcase = []
719744

720-
job_type=job_type+"/gather-extra"
745+
check_for_gather_libvirt_dir = check_if_gather_libvirt_dir_exists(spy_link,job_type)
746+
747+
if check_for_gather_libvirt_dir == True:
748+
job_type += "/gather-libvirt"
749+
else:
750+
job_type += "/gather-extra"
721751

722752
test_log_junit_dir_url = PROW_VIEW_URL + spy_link[8:] + "/artifacts/" + job_type + "/artifacts/junit/"
723753
symptom_detection_failed_testcase = []
@@ -1079,23 +1109,27 @@ def get_brief_job_info(prow_ci_name,prow_ci_link,start_date=None,end_date=None,z
10791109
lease, _ = get_quota_and_nightly(job)
10801110
if zone is not None and lease not in zone :
10811111
continue
1112+
job_status = check_job_status(job)
10821113
cluster_status=cluster_deploy_status(job)
10831114
i=i+1
10841115
job_dict = {}
10851116
job_dict["Build"] = prow_ci_name
10861117
job_dict["Prow Job ID"] = job_id
10871118
job_dict["Install Status"] = cluster_status
10881119
job_dict["Lease"]=lease
1089-
if cluster_status == 'SUCCESS' and "sno" not in prow_ci_link:
1090-
job_type,_ = job_classifier(job)
1091-
_, e2e_fail_test_count, error_object = get_all_failed_tc(job,job_type)
1092-
if all(value == None for value in error_object.values()):
1093-
if e2e_fail_test_count == 0:
1094-
job_dict["Test result"] = "PASS"
1095-
elif e2e_fail_test_count > 0:
1096-
job_dict["Test result"] = str(e2e_fail_test_count) + " testcases failed"
1097-
else:
1098-
job_dict["Test result"] = "Failed to get Test summary"
1120+
if job_status == 'SUCCESS' and "sno" not in prow_ci_link:
1121+
job_dict["Test result"] = "PASS"
1122+
elif job_status == 'FAILURE' and "sno" not in prow_ci_link:
1123+
if cluster_status == 'SUCCESS':
1124+
job_type,_ = job_classifier(job)
1125+
_, e2e_fail_test_count, error_object = get_all_failed_tc(job,job_type)
1126+
if all(value == None for value in error_object.values()):
1127+
if e2e_fail_test_count == 0:
1128+
job_dict["Test result"] = "PASS"
1129+
elif e2e_fail_test_count > 0:
1130+
job_dict["Test result"] = str(e2e_fail_test_count) + " testcases failed"
1131+
else:
1132+
job_dict["Test result"] = "Failed to get Test summary"
10991133
summary_list.append(job_dict)
11001134
return summary_list
11011135

0 commit comments

Comments
 (0)