Skip to content

Fix support dates #906

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: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions release-tools/contrib/get_supported_version_csi-sidecar.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def end_of_life_grouped_versions(versions):
"""
supported_versions = []
# Prepare dates for later calculation
now = datetime.datetime.now()
one_year = datetime.timedelta(days=365)
three_months = datetime.timedelta(days=90)
now = datetime.date.today()
one_year = now - relativedelta(years=1)
three_months = now - relativedelta(months=3)

# get the newer versions on top
sorted_versions_list = sorted(versions.items(), key=lambda x: x[0], reverse=True)
Expand All @@ -89,10 +89,10 @@ def end_of_life_grouped_versions(versions):
first_release = v[1][-1]
last_release = v[1][0]
# if the release is less than a year old we support the latest patch version
if now - first_release[1] < one_year:
if first_release[1] >= one_year:
supported_versions.append(last_release)
# if the main release is older than a year and has a recent path, this is supported
elif now - last_release[1] < three_months:
# if the main release is older than a year and has a recent patch, this is supported
elif last_release[1] >= three_months:
supported_versions.append(last_release)
return supported_versions

Expand All @@ -109,7 +109,7 @@ def get_release_docker_image(repo, version):
def get_versions_from_releases(repo):
"""
Using `gh` cli get the github releases page details then
create a list of grouped version on major.minor
create a list of grouped version on major.minor
and for each give all major.minor.patch with release dates
"""
# Run the `gh release` command to get the release list
Expand All @@ -125,7 +125,7 @@ def get_versions_from_releases(repo):
continue
major, minor, patch = parsed_version

published = datetime.datetime.strptime(parts[3], '%Y-%m-%dT%H:%M:%SZ')
published = datetime.datetime.strptime(parts[3], '%Y-%m-%dT%H:%M:%SZ').date()
versions[(major, minor)].append((version, published))
return(versions)

Expand Down
Loading