Skip to content

Commit b77856e

Browse files
Merge pull request #92 from alokgoswami-ag/added_constant_file
added monitoring_config.py
2 parents 0984782 + 0ed2039 commit b77856e

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PROW_VIEW_URL = "https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs"
2+
JOB_LINK_URL= "https://prow.ci.openshift.org/"
3+
RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"

monitor.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
import requests
77
from datetime import datetime
88
import xml.etree.ElementTree as ET
9+
import constants
910

1011
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
1112
PROW_URL = ""
12-
PROW_VIEW_URL = "https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs"
1313
final_job_list=[]
14-
RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"
14+
1515

1616
def fetch_release_date(release):
1717
'''
1818
Returns the created date of release
1919
'''
20-
url = RELEASE_URL + release
20+
url = constants.RELEASE_URL + release
2121
try:
2222
response = requests.get(url, verify=False, timeout=15)
2323
if response.status_code == 200:
@@ -50,9 +50,9 @@ def set_prow_url(ci_job_type: str)->str:
5050
string: Value of PROW_URL
5151
'''
5252
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/"
5454
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/"
5656

5757
def load_config(config_file):
5858

@@ -210,7 +210,7 @@ def check_job_status(spy_link):
210210
Returns:
211211
string: Job run Status
212212
'''
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'
214214
try:
215215
response = requests.get(job_status_url, verify=False, timeout=15)
216216
if response.status_code == 200:
@@ -239,7 +239,7 @@ def cluster_deploy_status(spy_link):
239239

240240
job_type,job_platform = job_classifier(spy_link)
241241
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'
243243

244244
try:
245245
response = requests.get(mce_install_log_url, verify=False, timeout=15)
@@ -248,7 +248,7 @@ def cluster_deploy_status(spy_link):
248248
cluster_result = "MCE-INSTALL "+ cluster_status["result"]
249249
if cluster_status["result"] == "SUCCESS":
250250
# 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'
252252
response = requests.get(mce_power_log_url, verify=False, timeout=15)
253253
if response.status_code == 200:
254254
cluster_status = json.loads(response.text)
@@ -273,12 +273,12 @@ def cluster_deploy_status(spy_link):
273273
if "upgrade" in spy_link:
274274
version=version-0.01
275275

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'
277277
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'
279279
#Only 4.17 and above libvirt uses upi-installation.
280280
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'
282282

283283
try:
284284
response = requests.get(job_log_url, verify=False, timeout=15)
@@ -305,7 +305,7 @@ def cluster_creation_error_analysis(spylink):
305305
'''
306306

307307
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'
309309

310310
try:
311311
response = requests.get(job_log_url,verify=False)
@@ -349,7 +349,7 @@ def cluster_creation_error_analysis(spylink):
349349
#This is a temporary fix to check node details for older jobs.
350350
def check_if_gather_libvirt_dir_exists(spy_link,job_type):
351351

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
353353

354354
try:
355355
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):
368368
#This is a fix to check for sensitive information expose error.
369369
def check_if_sensitive_info_exposed(spy_link):
370370

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'
372372
try:
373373
response = requests.get(build_log_url, verify=False, timeout=15)
374374
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):
402402
else:
403403
job_type += "/gather-extra"
404404

405-
node_log_url = PROW_VIEW_URL + spy_link[8:] + \
405+
node_log_url = constants.PROW_VIEW_URL + spy_link[8:] + \
406406
"/artifacts/" + job_type +"/artifacts/oc_cmds/nodes"
407407

408408
pattern=r"(\d+\.\d+)"
@@ -446,7 +446,7 @@ def check_node_crash(spy_link):
446446

447447
if "mce" not in spy_link and "sno" not in spy_link:
448448
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/"
450450

451451
try:
452452
crash_log_response = requests.get(crash_log_url, verify=False, timeout=15)
@@ -545,7 +545,7 @@ def get_quota_and_nightly(spy_link):
545545

546546
_,job_platform = job_classifier(spy_link)
547547
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"
549549
try:
550550
build_log_response = requests.get(build_log_url, verify=False, timeout=15)
551551
if 'ppc64le' in spy_link:
@@ -639,7 +639,7 @@ def get_failed_monitor_testcases(spy_link,job_type):
639639
'''
640640

641641
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/"
643643

644644
try:
645645
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):
650650

651651
if monitor_test_failure_summary_filename_match is not None:
652652
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
654654
response_2 = requests.get(test_log_url,verify=False, timeout=15)
655655
if response_2.status_code == 200:
656656
data = response_2.json()
@@ -690,7 +690,7 @@ def get_failed_monitor_testcases_from_xml(spy_link,job_type):
690690
test_type = "conformance-tests"
691691
else:
692692
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/"
694694
try:
695695
response = requests.get(test_log_junit_dir_url, verify=False, timeout=15)
696696

@@ -700,7 +700,7 @@ def get_failed_monitor_testcases_from_xml(spy_link,job_type):
700700

701701
if test_failure_summary_filename_match is not None:
702702
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
704704
response = requests.get(test_log_url,verify=False,timeout=15)
705705
if response.status_code == 200:
706706
root = ET.fromstring(response.content)
@@ -783,7 +783,7 @@ def get_failed_e2e_testcases(spy_link,job_type):
783783
test_type = "conformance-tests"
784784
else:
785785
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/"
787787
try:
788788
response = requests.get(test_log_junit_dir_url, verify=False, timeout=15)
789789

@@ -793,7 +793,7 @@ def get_failed_e2e_testcases(spy_link,job_type):
793793

794794
if test_failure_summary_filename_match is not None:
795795
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
797797
response_2 = requests.get(test_log_url,verify=False, timeout=15)
798798
if response_2.status_code == 200:
799799
data = response_2.json()
@@ -837,15 +837,15 @@ def get_junit_symptom_detection_testcase_failures(spy_link,job_type):
837837
else:
838838
job_type += "/gather-extra"
839839

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/"
841841
symptom_detection_failed_testcase = []
842842
try:
843843
response = requests.get(test_log_junit_dir_url,verify=False,timeout=15)
844844
if response.status_code == 200:
845845
junit_failure_summary_filename_re = re.compile('junit_symptoms.xml')
846846
junit_failure_summary_filename_match = junit_failure_summary_filename_re.search(response.text, re.MULTILINE|re.DOTALL)
847847
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"
849849
response_2 = requests.get(test_log_junit_url,verify=False,timeout=15)
850850
root = ET.fromstring(response_2.content)
851851
for testcase in root.findall('.//testcase'):
@@ -927,7 +927,7 @@ def check_ts_exe_status(spylink,jobtype):
927927
test_type = "conformance-tests"
928928
else:
929929
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"
931931
try:
932932
response = requests.get(test_exe_status_url, verify=False, timeout=15)
933933
if response.status_code == 200:
@@ -1255,7 +1255,7 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
12551255
builds_to_deleted.append(build)
12561256
continue
12571257
i=i+1
1258-
print(i,"Job link: https://prow.ci.openshift.org/"+build)
1258+
print(i,"Job link:"+constants.JOB_LINK_URL+build)
12591259

12601260
build_status = check_job_status(build)
12611261
sensitive_info_expose_status=check_if_sensitive_info_exposed(build)

0 commit comments

Comments
 (0)