[chef-infra-client] Add automation script (#358)

This commit is contained in:
Marc Wrobel
2024-07-20 09:53:29 +02:00
committed by GitHub
parent 4a8e693248
commit 2704265b91

23
src/chef-infra-client.py Normal file
View File

@@ -0,0 +1,23 @@
from bs4 import BeautifulSoup
from common import dates, http, releasedata
from common.git import Git
"""Fetch released versions from docs.chef.io and retrieve their date from GitHub.
docs.chef.io needs to be scraped because not all tagged versions are actually released.
More context on https://github.com/endoflife-date/endoflife.date/pull/4425#discussion_r1447932411.
"""
with releasedata.ProductData("chef-infra-client") as product_data:
rn_response = http.fetch_url("https://docs.chef.io/release_notes_server/")
rn_soup = BeautifulSoup(rn_response.text, features="html5lib")
released_versions = [h2.get('id') for h2 in rn_soup.find_all('h2', id=True) if h2.get('id')]
git = Git("https://github.com/chef/chef-server.git")
git.setup(bare=True)
versions = git.list_tags()
for version, date_str in versions:
if version in released_versions:
date = dates.parse_date(date_str)
product_data.declare_version(version, date)