Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
18 changes: 16 additions & 2 deletions monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,28 @@ def fetch_release_date(release):
sys.exit(1)
if response.status_code == 200:
soup = BeautifulSoup(response.text, 'html.parser')
forms = soup.find_all("form", {"method": "GET"})
p_elements = soup.find_all("p")
for p in p_elements:
p_ele = p.string
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
for form in forms:
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:
start_date = line.split(" ")[1]+" "+line.split(" ")[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)
Expand Down