Skip to content

Commit acf43a9

Browse files
Merge pull request #109 from alokgoswami-ag/fix-release-date
fix get release date
2 parents 20fccf0 + d7b85a6 commit acf43a9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
STABLE_RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"
44
DEV_PREVIEW_RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-dev-preview-ppc64le/release/"
55
HYPERVISOR_CONNECTION_ERROR = "failed to connect to the hypervisor"
6+
RELEASE_BASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org"

monitor.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,28 @@ def fetch_release_date(release):
3030
sys.exit(1)
3131
if response.status_code == 200:
3232
soup = BeautifulSoup(response.text, 'html.parser')
33+
forms = soup.find_all("form", {"method": "GET"})
3334
p_elements = soup.find_all("p")
3435
for p in p_elements:
3536
p_ele = p.string
3637
if p_ele:
3738
if "Created:" in p_ele:
3839
start_date = p_ele.split(" ")[1]+" "+p_ele.split(" ")[2]
39-
break
40-
return start_date
40+
return start_date
41+
for form in forms:
42+
a_tag = form.find("a", href=True)
43+
if a_tag and "changelog" in a_tag["href"]:
44+
changelog_url = constants.RELEASE_BASE_URL + a_tag["href"]
45+
changelog_resp = requests.get(changelog_url, verify=False, timeout=15)
46+
if changelog_resp.status_code == 200:
47+
lines = changelog_resp.text.splitlines()
48+
for line in lines:
49+
if "Created:" in line:
50+
start_date = line.split(" ")[1]+" "+line.split(" ")[2]
51+
return start_date
52+
else:
53+
print(f"Failed to get the changelog page.")
54+
sys.exit(1)
4155
else:
4256
print(f"Failed to get the release page. {response.text}")
4357
sys.exit(1)

0 commit comments

Comments
 (0)