Skip to content

fix get release date #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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"
20 changes: 18 additions & 2 deletions monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down