diff --git a/constants.py b/constants.py index c9ca210..e41685c 100644 --- a/constants.py +++ b/constants.py @@ -3,3 +3,4 @@ STABLE_RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/" DEV_PREVIEW_RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-dev-preview-ppc64le/release/" HYPERVISOR_CONNECTION_ERROR = "failed to connect to the hypervisor" +RELEASE_BASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org" diff --git a/monitor.py b/monitor.py index 7a14db5..929f6de 100644 --- a/monitor.py +++ b/monitor.py @@ -35,8 +35,24 @@ def fetch_release_date(release): if p_ele: if "Created:" in p_ele: start_date = p_ele.split(" ")[1]+" "+p_ele.split(" ")[2] - break - return start_date + return start_date + form = soup.find("form", {"method": "GET"}) + if form: + a_tag = form.find("a", href=True) + if a_tag and "changelog" in a_tag["href"]: + changelog_url = constants.RELEASE_BASE_URL + a_tag["href"] + changelog_resp = requests.get(changelog_url, verify=False, timeout=15) + if changelog_resp.status_code == 200: + lines = changelog_resp.text.splitlines() + for line in lines: + if "Created:" in line: + parts = line.split() + if len(parts) >= 3: + start_date = parts[1] + " " + parts[2] + return start_date + else: + print(f"Failed to get the changelog page.") + sys.exit(1) else: print(f"Failed to get the release page. {response.text}") sys.exit(1)