-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Will be used in endoflife-date/endoflife.date#5518. --------- Signed-off-by: Kaiming Zhang <[email protected]> Co-authored-by: Marc Wrobel <[email protected]>
- Loading branch information
1 parent
a029f0e
commit cb9cf44
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import logging | ||
|
||
import yaml | ||
from common import dates, http, releasedata | ||
|
||
"""Fetch version data for Kuma from https://raw.githubusercontent.com/kumahq/kuma/master/versions.yml. | ||
""" | ||
|
||
RELEASE_FIELD = 'release' | ||
RELEASE_DATE_FIELD = 'releaseDate' | ||
EOL_FIELD = 'endOfLifeDate' | ||
|
||
with releasedata.ProductData("kuma") as product_data: | ||
yml_response = http.fetch_url("https://raw.githubusercontent.com/kumahq/kuma/master/versions.yml") | ||
versions_data = yaml.safe_load(yml_response.text) | ||
|
||
# Iterate through the versions and their associated dates | ||
for version_info in versions_data: | ||
release_name = version_info[RELEASE_FIELD] | ||
if not release_name.endswith('.x'): | ||
logging.info(f"skipping release with name {release_name}: does not end with '.x'") | ||
continue | ||
|
||
if RELEASE_DATE_FIELD not in version_info or EOL_FIELD not in version_info: | ||
logging.info(f"skipping release with name {release_name}: does not contain {RELEASE_DATE_FIELD} or {EOL_FIELD} fields") | ||
continue | ||
|
||
release = product_data.get_release(release_name.replace('.x', '')) | ||
|
||
release_date = dates.parse_date(version_info[RELEASE_DATE_FIELD]) | ||
release.set_field('releaseDate', release_date) | ||
|
||
eol = dates.parse_date(version_info[EOL_FIELD]) | ||
release.set_field('eol', eol) |