Files
endoflife-date-release-data/src/google-kubernetes-engine.py
Marc Wrobel e62676b5c4 [google-kubernetes-engine] Normalize script (#464)
The script used to parse different channel for historical (forgotten) reasons. This is the only script that works that way, and release data is not supposed to be consumed by other clients than endoflife.date. So aligning this script for all the other scripts.

In case other channel data is useful for someone, it would be preferable to create multiple products so that the data is available through our official API.
2025-07-12 10:29:33 +02:00

29 lines
1.1 KiB
Python

import logging
from common import dates, http
from common.releasedata import ProductData, config_from_argv
"""Fetches versions from Google Kubernetes Engine release notes.
This script does not work for versions prior to March 29, 2021, as the release note format was different before that date.
"""
config = config_from_argv()
with ProductData(config.product) as product_data:
html = http.fetch_html(config.url)
regex = config.data.get('regex')
for section in html.find_all('section', class_='releases'):
for h2 in section.find_all('h2'): # h2 contains the date
date = dates.parse_date(h2.get('data-text'))
for li in h2.find_next('div').find_all('li'):
if "versions are now available" not in li.text:
logging.debug(f"Skipping {li.text}: does not contain new versions")
continue
for sub_li in li.find_all('li', recursive=True):
match = config.first_match(sub_li.text.strip())
if match:
product_data.declare_version(config.render(match), date)