Skip to content

Commit 25b5cf4

Browse files
KeerthanaAPShilpa-Gokul
authored andcommitted
Added fix for the issue in fetching release info for 4.19 releases
Signed-off-by: KeerthanaAP <[email protected]>
1 parent debda87 commit 25b5cf4

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PROW_VIEW_URL = "https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs"
22
JOB_LINK_URL= "https://prow.ci.openshift.org/"
3-
RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"
3+
STABLE_RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"
4+
DEV_PREVIEW_RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-dev-preview-ppc64le/release/"
45
HYPERVISOR_CONNECTION_ERROR = "failed to connect to the hypervisor"

monitor.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,27 @@ def fetch_release_date(release):
1717
'''
1818
Returns the created date of release
1919
'''
20-
url = constants.RELEASE_URL + release
20+
2121
try:
22+
url = constants.STABLE_RELEASE_URL + release
2223
response = requests.get(url, verify=False, timeout=15)
24+
if response.status_code == 404:
25+
url = constants.DEV_PREVIEW_RELEASE_URL + release
26+
response = requests.get(url, verify=False, timeout=15)
27+
if response.status_code == 404:
28+
print(f"Failed to get the release page. {response.text}")
29+
sys.exit(1)
2330
if response.status_code == 200:
24-
soup = BeautifulSoup(response.text, 'html.parser')
25-
p_elements = soup.find_all("p")
26-
for p in p_elements:
31+
soup = BeautifulSoup(response.text, 'html.parser')
32+
p_elements = soup.find_all("p")
33+
for p in p_elements:
2734
p_ele = p.string
2835
if p_ele:
2936
if "Created:" in p_ele:
3037
start_date = p_ele.split(" ")[1]+" "+p_ele.split(" ")[2]
3138
break
32-
return start_date
33-
else:
39+
return start_date
40+
else:
3441
print(f"Failed to get the release page. {response.text}")
3542
sys.exit(1)
3643
except requests.Timeout as e:

0 commit comments

Comments
 (0)