[eks] Add EKS release automation

This commit is contained in:
Nemo
2022-07-10 12:45:35 +05:30
parent ef1d3fb233
commit b83e1ee375
3 changed files with 82 additions and 0 deletions

41
releases/eks.json Normal file
View File

@@ -0,0 +1,41 @@
{
"1.22.9": "2022-06-13",
"1.21.12": "2022-06-13",
"1.20.15": "2022-05-11",
"1.19.16": "2022-05-11",
"1.22.6": "2022-04-05",
"1.21.9": "2022-05-11",
"1.21.5": "2022-02-22",
"1.20.7": "2021-08-03",
"1.19.15": "2022-02-22",
"1.18.16": "2021-04-28",
"1.21.2": "2021-07-20",
"1.19.8": "2021-04-26",
"1.17.17": "2021-04-28",
"1.16.15": "2020-11-28",
"1.20.4": "2021-05-19",
"1.15.12": "2020-11-28",
"1.18.9": "2020-11-28",
"1.17.12": "2020-11-28",
"1.19.6": "2021-02-20",
"1.14.9": "2020-01-02",
"1.18.8": "2020-10-27",
"1.17.9": "2020-08-17",
"1.16.13": "2020-08-17",
"1.15.11": "2020-04-15",
"1.17.6": "2020-07-31",
"1.16.8": "2020-05-05",
"1.16.12": "2020-07-11",
"1.13.12": "2020-01-07",
"1.12.10": "2019-09-05",
"1.15.10": "2020-03-14",
"1.14.7": "2019-11-02",
"1.13.10": "2019-09-16",
"1.11.10": "2019-09-05",
"1.14.6": "2019-09-16",
"1.13.8": "2019-09-05",
"1.13.7": "2019-06-20",
"1.12.6": "2019-06-20",
"1.11.8": "2019-06-20",
"1.10.13": "2019-06-20"
}

View File

@@ -1,6 +1,9 @@
beautifulsoup4==4.11.1
cffi==1.15.1
html5lib==1.1
mwparserfromhell==0.6.4
pycparser==2.21
pygit2==1.9.2
python-frontmatter==1.0.0
PyYAML==5.4
six==1.16.0

38
src/eks.py Normal file
View File

@@ -0,0 +1,38 @@
import pygit2
import re
from datetime import datetime
import json
PATH = 'doc_source/kubernetes-versions.md'
TEMP_REPO_PATH = '/tmp/eks-docs'
REGEX = r"^\+ (?P<major>\d+)\\\.(?P<minor>\d+)\\\.(?P<patch>\d+)$"
versions = {}
def add_versions(c_versions, commit):
for v in c_versions:
if v not in versions:
version_string = "%s.%s.%s" % v
date = datetime.fromtimestamp(commit.commit_time).strftime('%Y-%m-%d')
versions[version_string] = date
def get_versions(markdown):
return re.findall(REGEX, markdown, re.MULTILINE)
repo = pygit2.Repository(TEMP_REPO_PATH)
prev = None
tree_list = []
for cur in repo.walk(repo.head.target):
if prev is not None:
for d in cur.tree.diff_to_tree(prev.tree).deltas:
if(d.new_file.path == PATH and PATH in cur.tree):
contents = cur.tree[PATH].data.decode('UTF-8')
add_versions(get_versions(contents), cur)
if cur.parents:
prev = cur
cur = cur.parents[0]
with open('releases/eks.json', 'w') as f:
f.write(json.dumps(versions, indent=2))