6
6
import requests
7
7
from datetime import datetime
8
8
import xml .etree .ElementTree as ET
9
+ import constants
9
10
10
11
urllib3 .disable_warnings (urllib3 .exceptions .InsecureRequestWarning )
11
12
PROW_URL = ""
12
- PROW_VIEW_URL = "https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs"
13
13
final_job_list = []
14
- RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"
14
+
15
15
16
16
def fetch_release_date (release ):
17
17
'''
18
18
Returns the created date of release
19
19
'''
20
- url = RELEASE_URL + release
20
+ url = constants . RELEASE_URL + release
21
21
try :
22
22
response = requests .get (url , verify = False , timeout = 15 )
23
23
if response .status_code == 200 :
@@ -50,9 +50,9 @@ def set_prow_url(ci_job_type: str)->str:
50
50
string: Value of PROW_URL
51
51
'''
52
52
if ci_job_type == 'p' or ci_job_type == 'z' :
53
- return "https://prow.ci.openshift.org/ job-history/gs/origin-ci-test/logs/"
53
+ return constants . JOB_LINK_URL + " job-history/gs/origin-ci-test/logs/"
54
54
elif ci_job_type == 'pa' :
55
- return "https://prow.ci.openshift.org/ job-history/gs/test-platform-results/logs/"
55
+ return constants . JOB_LINK_URL + " job-history/gs/test-platform-results/logs/"
56
56
57
57
def load_config (config_file ):
58
58
@@ -210,7 +210,7 @@ def check_job_status(spy_link):
210
210
Returns:
211
211
string: Job run Status
212
212
'''
213
- job_status_url = PROW_VIEW_URL + spy_link [8 :] + '/finished.json'
213
+ job_status_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/finished.json'
214
214
try :
215
215
response = requests .get (job_status_url , verify = False , timeout = 15 )
216
216
if response .status_code == 200 :
@@ -239,7 +239,7 @@ def cluster_deploy_status(spy_link):
239
239
240
240
job_type ,job_platform = job_classifier (spy_link )
241
241
if "mce" in spy_link :
242
- mce_install_log_url = PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/hypershift-mce-install/finished.json'
242
+ mce_install_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/hypershift-mce-install/finished.json'
243
243
244
244
try :
245
245
response = requests .get (mce_install_log_url , verify = False , timeout = 15 )
@@ -248,7 +248,7 @@ def cluster_deploy_status(spy_link):
248
248
cluster_result = "MCE-INSTALL " + cluster_status ["result" ]
249
249
if cluster_status ["result" ] == "SUCCESS" :
250
250
# check mce-power-create status also
251
- mce_power_log_url = PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/hypershift-mce-power-create-nodepool/finished.json'
251
+ mce_power_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/hypershift-mce-power-create-nodepool/finished.json'
252
252
response = requests .get (mce_power_log_url , verify = False , timeout = 15 )
253
253
if response .status_code == 200 :
254
254
cluster_status = json .loads (response .text )
@@ -273,12 +273,12 @@ def cluster_deploy_status(spy_link):
273
273
if "upgrade" in spy_link :
274
274
version = version - 0.01
275
275
276
- job_log_url = PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/ipi-install-' + job_platform + '-install/finished.json'
276
+ job_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/ipi-install-' + job_platform + '-install/finished.json'
277
277
if "sno" in spy_link :
278
- job_log_url = PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/upi-install-powervs-sno/finished.json'
278
+ job_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/upi-install-powervs-sno/finished.json'
279
279
#Only 4.17 and above libvirt uses upi-installation.
280
280
if version >= 4.16 and job_platform != "powervs" :
281
- job_log_url = PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/upi-install-' + job_platform + '/finished.json'
281
+ job_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/artifacts/' + job_type + '/upi-install-' + job_platform + '/finished.json'
282
282
283
283
try :
284
284
response = requests .get (job_log_url , verify = False , timeout = 15 )
@@ -305,7 +305,7 @@ def cluster_creation_error_analysis(spylink):
305
305
'''
306
306
307
307
job_type ,job_platform = job_classifier (spylink )
308
- job_log_url = PROW_VIEW_URL + spylink [8 :] + '/artifacts/' + job_type + '/ipi-install-' + job_platform + '-install/build-log.txt'
308
+ job_log_url = constants . PROW_VIEW_URL + spylink [8 :] + '/artifacts/' + job_type + '/ipi-install-' + job_platform + '-install/build-log.txt'
309
309
310
310
try :
311
311
response = requests .get (job_log_url ,verify = False )
@@ -349,7 +349,7 @@ def cluster_creation_error_analysis(spylink):
349
349
#This is a temporary fix to check node details for older jobs.
350
350
def check_if_gather_libvirt_dir_exists (spy_link ,job_type ):
351
351
352
- base_artifacts_dir_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type
352
+ base_artifacts_dir_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type
353
353
354
354
try :
355
355
response = requests .get (base_artifacts_dir_url , verify = False , timeout = 15 )
@@ -368,7 +368,7 @@ def check_if_gather_libvirt_dir_exists(spy_link,job_type):
368
368
#This is a fix to check for sensitive information expose error.
369
369
def check_if_sensitive_info_exposed (spy_link ):
370
370
371
- build_log_url = PROW_VIEW_URL + spy_link [8 :] + '/build-log.txt'
371
+ build_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + '/build-log.txt'
372
372
try :
373
373
response = requests .get (build_log_url , verify = False , timeout = 15 )
374
374
senstive_info_re = re .compile ('This file contained potentially sensitive information and has been removed.' )
@@ -402,7 +402,7 @@ def get_node_status(spy_link):
402
402
else :
403
403
job_type += "/gather-extra"
404
404
405
- node_log_url = PROW_VIEW_URL + spy_link [8 :] + \
405
+ node_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + \
406
406
"/artifacts/" + job_type + "/artifacts/oc_cmds/nodes"
407
407
408
408
pattern = r"(\d+\.\d+)"
@@ -446,7 +446,7 @@ def check_node_crash(spy_link):
446
446
447
447
if "mce" not in spy_link and "sno" not in spy_link :
448
448
job_type ,_ = job_classifier (spy_link )
449
- crash_log_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/ipi-conf-debug-kdump-gather-logs/artifacts/"
449
+ crash_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/ipi-conf-debug-kdump-gather-logs/artifacts/"
450
450
451
451
try :
452
452
crash_log_response = requests .get (crash_log_url , verify = False , timeout = 15 )
@@ -545,7 +545,7 @@ def get_quota_and_nightly(spy_link):
545
545
546
546
_ ,job_platform = job_classifier (spy_link )
547
547
lease = ""
548
- build_log_url = PROW_VIEW_URL + spy_link [8 :] + "/build-log.txt"
548
+ build_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/build-log.txt"
549
549
try :
550
550
build_log_response = requests .get (build_log_url , verify = False , timeout = 15 )
551
551
if 'ppc64le' in spy_link :
@@ -639,7 +639,7 @@ def get_failed_monitor_testcases(spy_link,job_type):
639
639
'''
640
640
641
641
monitor_tc_failures = []
642
- test_log_junit_dir_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/openshift-e2e-libvirt-test/artifacts/junit/"
642
+ test_log_junit_dir_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/openshift-e2e-libvirt-test/artifacts/junit/"
643
643
644
644
try :
645
645
response = requests .get (test_log_junit_dir_url , verify = False , timeout = 15 )
@@ -650,7 +650,7 @@ def get_failed_monitor_testcases(spy_link,job_type):
650
650
651
651
if monitor_test_failure_summary_filename_match is not None :
652
652
monitor_test_failure_summary_filename_str = monitor_test_failure_summary_filename_match .group (1 )
653
- test_log_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/openshift-e2e-libvirt-test/artifacts/junit/" + monitor_test_failure_summary_filename_str
653
+ test_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/openshift-e2e-libvirt-test/artifacts/junit/" + monitor_test_failure_summary_filename_str
654
654
response_2 = requests .get (test_log_url ,verify = False , timeout = 15 )
655
655
if response_2 .status_code == 200 :
656
656
data = response_2 .json ()
@@ -690,7 +690,7 @@ def get_failed_monitor_testcases_from_xml(spy_link,job_type):
690
690
test_type = "conformance-tests"
691
691
else :
692
692
test_type = "openshift-e2e-libvirt-test"
693
- test_log_junit_dir_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/"
693
+ test_log_junit_dir_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/"
694
694
try :
695
695
response = requests .get (test_log_junit_dir_url , verify = False , timeout = 15 )
696
696
@@ -700,7 +700,7 @@ def get_failed_monitor_testcases_from_xml(spy_link,job_type):
700
700
701
701
if test_failure_summary_filename_match is not None :
702
702
test_failure_summary_filename_str = test_failure_summary_filename_match .group (1 )
703
- test_log_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/" + test_failure_summary_filename_str
703
+ test_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/" + test_failure_summary_filename_str
704
704
response = requests .get (test_log_url ,verify = False ,timeout = 15 )
705
705
if response .status_code == 200 :
706
706
root = ET .fromstring (response .content )
@@ -783,7 +783,7 @@ def get_failed_e2e_testcases(spy_link,job_type):
783
783
test_type = "conformance-tests"
784
784
else :
785
785
test_type = "openshift-e2e-libvirt-test"
786
- test_log_junit_dir_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/"
786
+ test_log_junit_dir_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/"
787
787
try :
788
788
response = requests .get (test_log_junit_dir_url , verify = False , timeout = 15 )
789
789
@@ -793,7 +793,7 @@ def get_failed_e2e_testcases(spy_link,job_type):
793
793
794
794
if test_failure_summary_filename_match is not None :
795
795
test_failure_summary_filename_str = test_failure_summary_filename_match .group (1 )
796
- test_log_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/" + test_failure_summary_filename_str
796
+ test_log_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/" + test_type + "/artifacts/junit/" + test_failure_summary_filename_str
797
797
response_2 = requests .get (test_log_url ,verify = False , timeout = 15 )
798
798
if response_2 .status_code == 200 :
799
799
data = response_2 .json ()
@@ -837,15 +837,15 @@ def get_junit_symptom_detection_testcase_failures(spy_link,job_type):
837
837
else :
838
838
job_type += "/gather-extra"
839
839
840
- test_log_junit_dir_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/artifacts/junit/"
840
+ test_log_junit_dir_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/artifacts/junit/"
841
841
symptom_detection_failed_testcase = []
842
842
try :
843
843
response = requests .get (test_log_junit_dir_url ,verify = False ,timeout = 15 )
844
844
if response .status_code == 200 :
845
845
junit_failure_summary_filename_re = re .compile ('junit_symptoms.xml' )
846
846
junit_failure_summary_filename_match = junit_failure_summary_filename_re .search (response .text , re .MULTILINE | re .DOTALL )
847
847
if junit_failure_summary_filename_match is not None :
848
- test_log_junit_url = PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/artifacts/junit/junit_symptoms.xml"
848
+ test_log_junit_url = constants . PROW_VIEW_URL + spy_link [8 :] + "/artifacts/" + job_type + "/artifacts/junit/junit_symptoms.xml"
849
849
response_2 = requests .get (test_log_junit_url ,verify = False ,timeout = 15 )
850
850
root = ET .fromstring (response_2 .content )
851
851
for testcase in root .findall ('.//testcase' ):
@@ -927,7 +927,7 @@ def check_ts_exe_status(spylink,jobtype):
927
927
test_type = "conformance-tests"
928
928
else :
929
929
test_type = "openshift-e2e-libvirt-test"
930
- test_exe_status_url = PROW_VIEW_URL + spylink [8 :] + "/artifacts/" + jobtype + "/" + test_type + "/finished.json"
930
+ test_exe_status_url = constants . PROW_VIEW_URL + spylink [8 :] + "/artifacts/" + jobtype + "/" + test_type + "/finished.json"
931
931
try :
932
932
response = requests .get (test_exe_status_url , verify = False , timeout = 15 )
933
933
if response .status_code == 200 :
@@ -1255,7 +1255,7 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
1255
1255
builds_to_deleted .append (build )
1256
1256
continue
1257
1257
i = i + 1
1258
- print (i ,"Job link: https://prow.ci.openshift.org/" + build )
1258
+ print (i ,"Job link:" + constants . JOB_LINK_URL + build )
1259
1259
1260
1260
build_status = check_job_status (build )
1261
1261
sensitive_info_expose_status = check_if_sensitive_info_exposed (build )
0 commit comments